Gnuplot,图线颜色

Sop*_*ner 2 gnuplot

在gnuplot中,我绘制如下图:

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
Run Code Online (Sandbox Code Playgroud)

它很好,但我的图形的线条颜色仍然是红色(默认),请你帮我设置为蓝色.

and*_*ras 6

你错过了plot命令的一个参数; 尝试

plot "file.dat" using 1:2 title "Graph" with lines ls 1
Run Code Online (Sandbox Code Playgroud)

ls 1告诉gnuplot使用linestyle 1.如果你没有指定线条样式,它只会循环显示其默认值.当你在它时,你可以设置

set style data lines
Run Code Online (Sandbox Code Playgroud)

在绘图之前.这样gnuplot将使用线条绘制数据,您不必在每个绘图命令中指定它.但是,如果您只绘制一行,则可以在一个命令中完成所有操作:

plot "file.dat" using 1:2 title "Graph" with lines lc rgb 'blue'
Run Code Online (Sandbox Code Playgroud)