Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot line type does not want to be changed

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.

like image 372
Mato Avatar asked Jan 23 '14 10:01

Mato


1 Answers

There are several ways to change the line colors using set commands:

  1. 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.

  2. 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
    
  3. 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
like image 66
Christoph Avatar answered Oct 23 '22 20:10

Christoph