gnuplot空y范围/绘制数据为0

时间:2019-01-13 22:57:31

标签: gnuplot

假设我有一系列重要数据,这些数据显示为0。我该如何使用gnuplot绘制这些数据,将这些度量视为一条线,而不会收到以下错误:Warning: empty y range [0:0], adjusting to [-1:1]

这是MWE:

plot '-'
input> 1 0
input> 2 0
input> 3 0
input> e

这是我看到的:

enter image description here

我期望一行包含三个数据点,从1,0到3,0。我该怎么做?

1 个答案:

答案 0 :(得分:1)

正如@Ethan Merritt在其评论中提到的那样,您应该/需要显式设置绘图范围。我的首选方式是将其包括在绘图指令中:

plot[0:4][-.5:+.5] '-'

非常适合您的样本数据。如Ethan所说,还有其他设置范围的方法。

要获得直线而不是点,您再次需要指示gnuplot,只需将其告诉with lines,或者如果您希望使用简写,请w l

plot[0:4][-.5:+.5] '-' w l

为您提供示例数据:

enter image description here

相关问题