在gnuplot中包含数据点

时间:2012-12-17 15:09:11

标签: plot gnuplot smooth

将数据设为:

38 52.26
41 46.34
42 49.49

使用smooth行;我可以在图表行中包含这些点而不将其绘制两次吗?

现在我用:

plot "foo.dat" using ($0):2 smooth csplines title "foo", \
               '' using ($0):2 with points title ""

Sample graph

扩展简化数据集:

38     52.26
39     46.34
42     57.29
43     60.41
44     53.57
45     51.49
46     48.24
49     58.50
50     56.85
51     55.56
52     62.81
54     51.76
55     46.94
56     46.35
57     52.76
59     49.49
62     51.78
63     48.24
65     54.46
66     50.00

1 个答案:

答案 0 :(得分:6)

这是我的方法:

...
plot "file" using 1:3 notitle with points linestyle 1, \
     "" using 1:3 notitle smooth csplines with lines linestyle 1, \
     1 / 0 title "title" with linespoints linestyle 1
...

enter image description here

第一个条目绘制图表上的点,没有图例。 第二个条目绘制图表上的平滑线,同样没有图例。 第三个条目仅用于图例,使用组合的线点。

如果在平滑线上使用线点,它将显示使其平滑的所有点,而不仅仅是数据点。

'linestyle'告诉gnuplot使用相同的样式绘制所有数据,基本上合成线和点来制作线点。第三行“线点”仅适用于图例,并未在图上添加任何数据。