Take the 2-minute tour ×

In gnuplot, I draw a graph like below:

gnuplot> set title "Performance analysis" font ", 16"
gnuplot> set xlabel "Array size" font ", 14"
gnuplot> set ylabel "Time, milliseconds" font ", 14"
gnuplot> set xrange [0:25]
gnuplot> set yrange [0:6300]
gnuplot> set xtics (5, 9, 11, 13, 15, 17, 19, 21, 23)
gnuplot> set ytics (88, 296, 433, 835, 1067, 1516, 2592, 3920, 6214)
gnuplot> set style line 1 linecolor rgb "blue"
gnuplot> plot "file.dat" using 1:2 title "Graph" with lines

it is fine, but the line colour of my graph is still red (default), could you please help me to set it to the blue colour.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You are missing one argument to the plot command; try

plot "file.dat" using 1:2 title "Graph" with lines ls 1

ls 1 tells gnuplot to use linestyle 1. If you don't specify the line style, it will just cycle through its defaults. While you're at it, you could set

set style data lines

before plotting. That way gnuplot will plot data with lines, and you don't have to specify it in each plot command. If you're only plotting one line, though, you can do it all in one command:

plot "file.dat" using 1:2 title "Graph" with lines lc rgb 'blue'
share|improve this answer

Your Answer


