gnuplot:如何避免使用满曲线缩放为0?

问题描述 投票:0回答:1

如果绘制实曲线with filledcurves,gnuplot似乎总是将y轴自动缩放为零。为什么?有毛病吗我有想念吗?如何避免?有什么想法吗?

如果我这样做:

plot $Data u 1:2 w filledcurves noautoscale

我收到错误消息:

x range is invalid

显然,没有要进行“无自动缩放”的操作。如果我先做另一个绘图,它也会自动将fillcurves缩放为0。因此,我没有看到一种方法单独将填充曲线自动缩放为[[not到0。

代码:

### how to autoscale a filled curve NOT to zero? reset session $Data <<EOD 3.8 3.8 9.1 3.8 9.1 9.1 3.8 9.1 3.8 3.8 EOD unset key set multiplot layout 1,4 set title "with lines\n\n" plot $Data u 1:2 w lp pt 7 set title "with filledcurves\n\n" plot $Data u 1:2 w filledcurves set title "with lines \\&\nwith filledcurves\n" plot $Data u 1:2 w lp pt 7, '' u 1:2 w filledcurves set title "with lines \\&\nwith filledcurves\n+noautoscale" plot $Data u 1:2 w lp pt 7, '' u 1:2 w filledcurves noautoscale unset multiplot ### end of code

结果:

enter image description here
gnuplot fill
1个回答
1
投票
这是接受以下形式的绘图命令的意外结果:

plot $data using x:y1:y2 with filledcurves {options}

这是支持填充两条曲线之间的区域所必需的。由于第二个y值在您的示例中未初始化,因此它保持为零并影响y的自动缩放范围。 

在开发版本中(以及在5.4的-rc1中,您应该下载并测试),一种解决方法是即使有三列输入,也强制closed选项:

plot $data using 1:2:2 with filledcurves closed

不幸的是,版本5.2在此处不接受closed作为关键字。是的,这是一个错误。 

如果您碰巧知道内部某个点的坐标(例如,在这种情况下为[7,7],那么您也可以使用以下选项:

plot $data using 1:2 with filledcurves xy=7,7

© www.soinside.com 2019 - 2024. All rights reserved.