Gnuplot 5.2 patchlevel 2中SVG终端数据点颜色无法修改问题咨询
I’ve run into this exact quirk with Gnuplot 5.2’s SVG terminal before—older patch levels tend to treat line and point colors separately for linespoints plots, unlike other terminals that inherit the line color for points automatically. Here’s how to fix it:
Solution: Explicitly Set Point Color in Your Style Line
Modify your style line definition to explicitly specify both line color (lc rgb) and point color (pc rgb). This ensures the SVG terminal applies the color to both lines and points:
set term svg enh size 1800,1800 font "Times,20" rounded background rgb white set output 'plot.svg' # Define line style with matching line and point color set style line 1 lc rgb 'red' pc rgb 'red' pt 7 ps 1 lt 1 lw 2 plot 'data.file' w lp ls 1 ti "Set 1"
Extending to Three Datasets
For your three datasets, just create additional style lines with unique colors and point types:
set term svg enh size 1800,1800 font "Times,20" rounded background rgb white set output 'plot.svg' # Style for Dataset 1 set style line 1 lc rgb 'red' pc rgb 'red' pt 7 ps 1 lt 1 lw 2 # Style for Dataset 2 set style line 2 lc rgb 'blue' pc rgb 'blue' pt 6 ps 1 lt 1 lw 2 # Style for Dataset 3 set style line 3 lc rgb 'green' pc rgb 'green' pt 5 ps 1 lt 1 lw 2 # Plot all three datasets plot 'data1.file' w lp ls 1 ti "Set 1", \ 'data2.file' w lp ls 2 ti "Set 2", \ 'data3.file' w lp ls 3 ti "Set 3"
Why This Happens
In Gnuplot 5.2 patchlevel 2, the SVG terminal’s implementation of linespoints doesn’t automatically inherit the line color for points. Other terminals (like PNG or X11) handle this inheritance by default, which is why your original config works elsewhere. Adding pc rgb explicitly overrides this behavior and ensures points match the line color.
内容的提问来源于stack exchange,提问作者Peter Nemeth .malomsok.

