Share

gnuplot development

Tracker: Patches

7 mechanism to redefine base linetypes - ID: 2004590
Last Update: Settings changed ( sfeam )

Users are sometimes unhappy with gnuplot's default set of linetypes.
Some reasons given are
- need to match style requirements of a surrounding document
- the default sequence is unfriendly to color-blind audiences
- different terminals do not match in color sequence
- personal taste

To some extent you have been able to overcome this by defining custom line
styles, but this required giving an explicit line style for each plot and
did not work for auto-generated linetypes such as contour lines. Version
4.2 offered a rather cryptic option to work around this, "set style
increment user", but it has a number of limitations. For example, line
style definitions are lost after each "reset", and use of this option
doesn't mix well with older scripts that use line styles already for a
separate purpose.

This patchset implements a more complete approach. It allows users to
redefine the base linetypes. The redefinitions are persistent; i.e. they
are not affected by "reset". The command options are identical to those
for "set style line".

For example:
set linetype 1 lw 2 lc rgb "blue" pointtype 6
set linetype 2 lw 2 lc rgb "forest-green" pt 8

Everywhere that uses lt 1 will now get a thick blue line rather than a thin
red line (the existing unchangeable meaning of lt 1). This includes
further modifications such as linestyles.

Continuing the example, suppose you have an existing script that contains
set style line 3 lt 1 pointtype 3
plot foo with linespoints ls 3, baz with lines lt 1

Before you would have gotten two thin red lines, one with stars; now you
will get two thick blue lines, one with stars.






Ethan Merritt ( sfeam ) - 2008-06-27 23:07

7

Pending

Accepted

Nobody/Anonymous

None

None

Public


Comments ( 12 )




Date: 2009-12-31 22:33
Sender: sfeamProject Admin

Added a new command
set linetype cycle N
This recycles the linetype properties (linecolor, linewidth) every N
linetype indices. It does not affect the point properties (pointtype,
pointsize, pointinterval). The intent is eventually to separate out the
point properties and dash patterns, but that can be tackled later.

Now in CVS 4.5


Date: 2009-12-30 23:19
Sender: sfeamProject Admin

Update to apply against current CVS


Date: 2009-12-07 04:55
Sender: sfeamProject Admin

Update to apply against current CVS.
Add a color file that defines linetypes using colors from the tango
desktop theme.


Date: 2009-06-01 05:00
Sender: sfeamProject Admin

In preparation for eventual release of gnuplot version 4.4, existing bugs
and patchsets are being re-prioritized.

I have chosen to use the following categories

9 - should be included in 4.4.rc1 if possible
7 - looks reasonable to me, but not high priority for 4.4.rc1
5 - default priority for newly submitted patches
2 - not under active consideration


These are my personal ratings. If you want to argue for a different
priority on one or more patches - go right ahead.

Ethan Merritt (sfeam)



Date: 2008-08-18 07:29
Sender: wieferink


Additionally, a new key word "dashtype" should be
introduced (and substitute "linetype" in some
contexts).

Juergen



Date: 2008-08-18 06:27
Sender: mikulik


This works very well!

The only idea: I wonder how it works with "linetype recycling" -- is it
possible to set the first 8 linetypes, and then order that linetype 9
equals linetype 1? Probably a new command would be needed there, such as
set linetypes 8



Date: 2008-07-10 18:56
Sender: sfeamProject Admin


> Would it be possible to switch the linestyles to be persistent instead,
> maybe depending on a "set" command.

I tried it that way first, by introducing an extra flag for the linestyle
set style line N {permanent} ....
But I was not very happy with how it worked. The biggest problem is that
it breaks all previous scripts that assume linestyles are temporary, and
when the linestyle goes away then the base linetype underneath is
unchanged. But if a script explicitly sets and unsets a line style, then
in the "permanent linestyle + set increment user" mode you lose the
linestyle altogether. I thought about adding additional bookkeeping so
that there could be a "temporary linestyle 1" and also a "permanent
linestyle 1", but it seemed both overly complicated and confusing.

> As far as I understand the "linetype" is the dash pattern plus some
> default color, which can be overriden per plot using "linecolor".

Also point type.

But yes, it would be nice to add a "dashtype" parameter everywhere. That
would be a non-trivial amount of work, since it requires defining a new
terminal driver entry point and auditing all terminal drivers that support
dashed lines.

> But then, linetype and linestyle would serve almost exactly the same
purpose.

Indeed. I think we have outgrown the need for separate linestyles. But
since we place such a high priority on backwards compatibility, I don't see
how we can just get rid of them.


Date: 2008-07-10 18:03
Sender: wieferink


As far as I understand the "linetype" is the dash pattern plus some
default color, which can be overriden per plot using "linecolor". With
your patch it would only be consequent also to include a "dashtype" to
allow for a change of the sequence of the dash patterns. But then,
linetype and linestyle would serve almost exactly the same purpose.

Would it be possible to switch the linestyles to be persistent instead,
maybe depending on a "set" command. Or to introduce "reset nolinestyles"?

Juergen



Date: 2008-06-27 23:12
Sender: sfeamProject Admin


File Added: .gnuplot


Date: 2008-06-27 23:10
Sender: sfeamProject Admin


File Added: linetype_part4_25jun2008.patch


Date: 2008-06-27 23:10
Sender: sfeamProject Admin


File Added: linetype_part3_23jun2008.patch


Date: 2008-06-27 23:08
Sender: sfeamProject Admin


File Added: linetype_part2_24jun2008.patch


Log in to comment.




Attached Files ( 3 )

Filename Description Download
linetypes_31dec2009.patch user-defined linetypes Download
tango_colors.gnuplot colors from the tango desktop theme Download
.gnuplot suggested .gnuplot file for testing Download

Changes ( 29 )

Field Old Value Date By
File Deleted 357215: 2009-12-31 22:34 sfeam
File Added 357283: linetypes_31dec2009.patch 2009-12-31 22:34 sfeam
close_date - 2009-12-31 22:33 sfeam
resolution_id None 2009-12-31 22:33 sfeam
status_id Open 2009-12-31 22:33 sfeam
File Added 357215: linetypes_30dec2009.patch 2009-12-30 23:20 sfeam
File Deleted 354166: 2009-12-30 23:20 sfeam
File Added 354167: tango_colors.gnuplot 2009-12-07 04:56 sfeam
File Added 354166: linetypes_all_06dec2009.patch 2009-12-07 04:55 sfeam
File Deleted 329233: 2009-12-07 04:53 sfeam
File Deleted 329232: 2009-12-07 04:53 sfeam
File Deleted 329231: 2009-12-07 04:53 sfeam
File Deleted 329230: 2009-12-07 04:53 sfeam
File Deleted 353090: 2009-12-07 04:53 sfeam
File Added 353090: linetypes_all_29nov2009.patch 2009-11-30 07:08 sfeam
File Deleted 282985: 2009-06-01 18:32 sfeam
File Added 329233: linetype_part4_01jun2009.patch 2009-06-01 18:32 sfeam
File Deleted 282984: 2009-06-01 18:31 sfeam
File Added 329232: linetype_part3_01jun2009.patch 2009-06-01 18:31 sfeam
File Added 329231: linetype_part2_01jun2009.patch 2009-06-01 18:30 sfeam
File Deleted 282983: 2009-06-01 18:30 sfeam
File Deleted 282982: 2009-06-01 18:29 sfeam
File Added 329230: linetype_part1_01jun2009.patch 2009-06-01 18:29 sfeam
priority 5 2009-06-01 05:00 sfeam
File Added 282986: .gnuplot 2008-06-27 23:12 sfeam
File Added 282985: linetype_part4_25jun2008.patch 2008-06-27 23:10 sfeam
File Added 282984: linetype_part3_23jun2008.patch 2008-06-27 23:10 sfeam
File Added 282983: linetype_part2_24jun2008.patch 2008-06-27 23:08 sfeam
File Added 282982: linetype_part1_24jun2008.patch 2008-06-27 23:07 sfeam