我正在尝试并排绘制两条填充曲线。但它们并没有相互接触,而是中间有一条白色的缝隙。怎么去除呢?
我尝试减少中间填充曲线的起点并增加终点 x 值,但它们之间仍然存在间隙。这就像填充曲线的一些默认行为。
这是 gnuplot 脚本
set title "Quantile"
set yrange[0:1.1]
set xlabel("x")
N(x) = 1/(sqrt(2*pi))*(exp(-x**2/2))
N1(x) = (x<=-1.96 || x>=1.96)? 1/(sqrt(2*pi))*(exp(-(x)**2/2)): 1/0
N2(x) = (x>=-1.96 && x<=1.96)? 1/(sqrt(2*pi))*(exp(-x**2/2)):1/0
set output "Quantile.png"
plot N1(x) with filledcurves y1=0 lc "cyan", N2(x) with filledcurves y1=0, N(x) with lines title "Normal Distribution" lw 2.5,
pause -1
我得到的输出
绘制函数时,gnuplot 使用一定数量的样本,默认为 100(检查
help samples
)。因此,增加这个数字直到间隙足够小。
因此,添加一行,例如:
set samples 1000