在 gnu plot 中使用不同的线绘制不同的数据集

Using different lines to plot different datasets in gnu plot

当我运行下面的gnuplot代码时,我得到了错误信息 情节中的“情节选项中的重复或矛盾论点”。

set xlabel "x"
set ylabel "y"

set key right outside

set terminal png enhanced size 1500,1000 font "Arial,20"

set output graphDataDir."graph.eps"

plot [0.5:] for [fname1 in list1] graphDataDir.fname1 using 1:2 with l title fname1 linewidth 2, \
for [fname2 in list2] graphDataDir.fname2 using 1:2 with lines dt 4 title fname2 linewidth 2;

我想做的是对“list1”中的数据使用实线,对“list2”使用虚线。

“list1”、“list2”包含文件名列表,“graphDataDir”是文件的目录路径,在命令行参数中给出。

我该如何解决这个问题?

错误消息是因为在你的 plot 命令的第二个子句中,线属性列表 dt 4 ... lw 2 被其他东西 title foo 打断,所以程序将其视为两个 different 组线路属性并抱怨您只能拥有一组。解决方法是更改​​

using 1:2 with lines dt 4 title fname2 linewidth 2

using 1:2 with lines dt 4 linewidth 2 title fname2

线条属性(颜色、宽度、虚线类型等)的顺序无关紧要,但所有属性必须在一起。