在gnuplot中包含数据点

Luc*_*ein 4 plot smooth gnuplot

数据如下:

38 52.26
41 46.34
42 49.49
Run Code Online (Sandbox Code Playgroud)

使用smooth线条; 我可以在图表行中包含这些点而无需绘制两次吗?

现在我使用:

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

示例图

扩展的简化数据集:

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

Łuk*_*hel 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
...
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

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

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

'linestyle'告诉gnuplot使用相同的样式绘制所有数据,基本上合成线和点来制作线点.第三行,'linespoints',仅适用于图例,并且不会在图上放置任何数据.

  • 无论这是否有效,请尝试在您的代码中包含一些解释.高质量的答案不仅可以提供解决方案,还可以解释它是如何工作的/为什么你这样做. (4认同)