Gnuplot:由左/右曲线限定的填充区域?

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

我有一个定义两条曲线的数据集,我想填充它们之间的区域。但是,与标准情况相反,横坐标是纵轴,纵坐标是纵坐标;横坐标表示深度,这是地球物理学中常见的绘图格式。换句话说,我想要类似的东西

 plot 's.dat' u 1:2:3 w filledcurves

但是交换轴使得填充区域不是在顶部和底部,而是在曲线的左侧和右侧,如图所示

plot 's.dat' u 2:1,'s.dat' u 3:1

我的数据集是这样的:

0.      -1.776  -0.880
160.    -1.775  -0.882
160.    -1.692  -0.799
320.    -1.692  -0.800
320.    -1.531  -0.634
480.    -1.534  -0.637
480.    -1.286  -0.394

这可能在Gnuplot吗?

托马斯

gnuplot
2个回答
1
投票

这是一个完全不同的解决方案,使用3D绘图风格“与zerror”。您将需要当前的gnuplot(版本5.2)。情节样式实际上并不是为此设计的,因此存在一些困难(例如,因为垂直于绘图平面绘制的x tic标记不可见,所有tic标签需要偏移以便于阅读)。

#
# [mis]use 3D plot style "with zerror" to create a plot of the xz
# plane with area fill between two sets of data points with
# equal coordinates on the vertical axis (x) but contrasting
# values on the horizontal axis (z).
#

set view 270, 0
set view azimuth -90
set xyplane at 0
unset ytics
set ztics offset  4, -2 out
set xtics offset  4

splot 's.dat' using 1:(0):(0.5*($2+$3)):2:3 with zerror notitle

enter image description here


1
投票

如果有一些x的值保证位于两条曲线之间,那么你可以分成两半。对于您显示的数据,x = -1将是合适的值,plot命令将是:

plot 's.dat' u 2:1 with filledcurve x=-1 lt 3, \
     's.dat' u 3:1 with filledcurve x=-1 lt 3

如果只能满足对中间x值的恒定要求,例如

 x=-1 for (0<y<500), x=0 for (500<y<1000)

然后,可以通过堆叠分段部分来构造图形。

enter image description here

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