Can you help me please? I want change one line type to dotted. I use these comannds:
gnuplot> set terminal png size 750,210 nocrop butt font "/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf" 8
gnuplot> set output "/root/data.png"
gnuplot> set xdata time
gnuplot> set timefmt "%Y-%m-%d"
gnuplot> set format x "%b %d"
gnuplot> set ylabel "item1"
gnuplot> set y2label "item2"
gnuplot> set y2tics
gnuplot> set datafile separator "|"
gnuplot> plot "/root/results.txt" using 1:2 title "item1" w lines lt 4, "/root/results.txt" using 1:3 title "item2" with lines
But I allways get only magenta color line. I have used Version 4.6 patchlevel 0. Thanks for replies.
There are several ways to change the line colors using set
commands:
Define line styles:
set style line 1 linetype 1 linecolor 7
set style line 2 linetype 1 linecolor rgb "#dd7700"
plot x linestyle 1, x**2 linestyle 2
You must explicitely specify which line style is used.
Choose and increment over line style instead of line type if nothing is specified:
set style line 1 linetype 1 linecolor 7
set style line 2 linetype 1 linecolor rgb "#dd7700"
set style increment user
plot x, x**2
Redefine the default line type (introduced in version 4.6.0):
set linetype 1 linecolor 7
set linetype 2 linetype 1 linecolor rgb "magenta"
plot x, x**2
Beware, that unlike line styles, redefinitions by set linetype
are persistent; they are not affected by reset
. To reset them you must use set linetype 1 default
.
So a minimal plotting script could look like:
reset
set terminal pngcairo dashed monochrome
set output "/root/data.png"
set xdata time
set timefmt "%Y-%m-%d"
set format x "%b %d"
set datafile separator "|"
set style data lines
plot "/root/results.txt" using 1:2 linetype 1, "" using 1:3 linetype 3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With