Hi,
at first, thanks for providing and maintaining gnuplot all those years.
When switching from GNUPLOT 4.6 patchlevel 2 (CentOS 7) to GNUPLOT 5.2 patchlevel 2 (SLES 15) (same for GNUPLOT 6.0 patchlevel 1), the SVG output file no longer used the colors defined using
e.g. "set style line 1 lt 1 lc rgb ..." when plotting using "plot ... with circles lc variable"
Expected behaviour:
Diff:
Attached sreenshot of pie-all-versions.png: version 4, 5, 6.
Attached: pie-chart-v4.svg - expected behavior in Version 4
Attached: pie-chart-v5.svg - unexpected behavior in Version 5
Attached: pie-chart-v6.svg - unexpected behavior in Version 6
The terminal type is not relevant here.
The issue is the deprecation of allowing a bare numeric value to be interpreted as a line color.
Short answer:
set style increment userstylesLong answer:
Gnuplot places a strong emphasis on preserving backward compatibility. But sometimes the addition of new features and code paths makes it impractical to preserve old behavior in cases where the old command did not provide enough information to unambiguously decide which of several newer options is appropriate. So we do allow some breakage across a major version upgrade, while attempting to mitigate the effects by providing a command to emulate the previous behavior.
gnuplot 3: In very old gnuplot versions there was no way to change properties of the default linetypes. "linetype 1" was always red, had linewidth 1.0 and associated point shape +. So back in gnuplot 3.7 and 3.8 (spanning the year 2000) if you wanted to change the properties for lines 1, 2, 3, etc you had to use a temporary "linestyle" instead. The commands in your script appear to date back to that era.
The flexibility of assigning properties to line types has greatly increased since gnuplot version 3. This has gradually made the use of line styles (as opposed to linetypes) unnecessary, and many program features and plotting styles introduced since then assume that you are using the new more flexible linetypes rather than the older "linestyle" variants unless you explicitly say otherwise. So
linetype 1is OK, andlinestyle 1is OK, but what the user might have intended for the color of the second plot, or second variable color became ambiguous.gnuplot 4: Gnuplot version 4.2 (2007) introduced commands
set style increment userstylesset style increment defaultthat told the program whether to prefer user-defined line style N or default line type N if both "linestyle N" and "linetype N" are defined. The Nth plot color or Nth variable color would track that preference. By the time of gnuplot version 4.6 (2012) users were advised to issue the command
set style increment userstylesif they wanted linestyle colors, although the program provided backward compatibility with older scripts as a configuration option. Your script falls into that category - it works in versions 4.2 to 4.6 either with or without that command.gnuplot 5: Version 5 (2015) switched the default to use linetypes in preference to linestyles. This is what you are seeing. In all version 5 releases your script still works, but requires an explicit
set style increment userstylesto override the default.Gnuplot version 6 (2023) has finally deprecated this option.
http://gnuplot.info/docs_6.0/loc602.html
There are several ways you might change your script for version 6. One way would be to change the colors of the linetypes themselves:
Another way would be to provide the colors directly in the plot command:
missing feature/bug: Unfortunately one seemingly reasonable way does not work
plot ... linestyle variableThat indeed seems like a fixable oversight. Let's try to get that fixed in the next version 6 release.
Hi Ethan,
thank you very much for all the explanations an the solutions.
I will go with "set linetype 1 lc rgb c_1" etc (works for gnuplot v4, v5 and v6).
FYI, my script dates back to 2019, on CentOS 7 with gnuplot version 4.x (https://ftp.fau.de/centos/7/os/x86_64/Packages/gnuplot-common-4.6.2-3.el7.x86_64.rpm)
(I have serveral scripts to produce SVG images automatically. When switching from gnuplot 4.6 (CentOS 7) to gnuplot 5.2 (SLES 15) only minimal changes were necessary: this change and changing 'set timefmt x "%Y-%m"' to 'set timefmt "%Y-%m"'.)
Bye, Reiner