无法在不显示不同点类型的情况下在 gnuplot 中绘制直线

Cannot plot straight lines in gnuplot without showing different point types

我正在使用 gnuplot 绘制图形,但绘图一直给我不同的点类型而不是直线。我只想用直线绘制它们,但不断得到 x 或加号或不同的符号。这是我的 gnuplot 脚本。

set terminal pdf
set output "temperatures.pdf"
set style line 1 lc rgb "red" lt 1
set style line 2 lc rgb "blue" lt 1
set style line 3 lc rgb "purple" lt 1
set style line 4 lc rgb "orange" lt 1
set style line 5 lc rgb "cyan" lt 1
set xrange [0:780]
set yrange [0:88]
set xlabel "Time (s)"
set ylabel "Temperature (°C)"
set key bottom right
plot "data.dat" using 6:1 ls 1 notitle, "data.dat" using 6:2 ls 2 notitle, "data.dat" using 6:3 ls 3 notitle, "data.dat" using 6:4 ls 4 notitle, "data.dat" using 6:5 ls 5 notitle, \
    NaN ls 1 title "600 MHz", NaN ls 2 title "800 MHz", NaN ls 3 title "1100 MHz", NaN ls 4 title "1300 MHz", NaN ls 5 title "1500 MHz"

有不同的绘图风格,例如with pointswith lineswith linespoints 等等。您还可以通过 w pw lw lp 缩写样式。检查 help with。 如果您未指定任何内容,则默认值为 with points。这就是你得到的。设置线型或线型并不一定意味着您只绘制一条线。您还必须明确使用 with lines.

顺便说一句,您可以通过指定''来使用上次使用的文件。为了便于阅读,您可以通过用 \ 分隔来编写多行(注意,\ 必须是行中的最后一个字符,之后不允许使用 space 或其他字符)。

尝试以下操作:

plot "data.dat" u 6:1 w l ls 1 title "600 MHz", \
     '' u 6:2 w l ls 2 title "800 MHz", \
     '' u 6:3 w l ls 3 title "1100 MHz", \
     '' u 6:4 w l ls 4 title "1300 MHz", \
     '' u 6:5 w l ls 5 title "1500 MHz"