这是用 Matplotlib 创建的。是否可以在 Gnuplot 5 中制作相同类型的阴影?
我不知道 gnuplot 有渐变填充选项,但我可能是错的。
以下是一个有点“丑陋”的解决方法。您基本上创建了 3 个相互重叠的图。您可能需要调整调色板以获得所需的颜色和平滑的过渡。
- 将调色板作为背景的虚拟图(即与图形一样大的颜色框)
- 覆盖上面的部分
y>f(x)
and y>0
to x2
-轴以及以下y<f(x)
and y<0
to x1
-axis.
- 再次策划
f(x)
to see f(x)
轴再次抽动
Edit:使用的早期版本的代码multiplot
。没必要,用一下就可以了set colorbox back
。但是之后set xzeroaxis ls -1
不再可见,添加plot 0 w l ls -1
反而。
Code:
### filled curve with gradient
reset session
f(x) = sin(x)/(1+x)
fabove(x) = f(x)<0 ? 0 : f(x)
fbelow(x) = f(x)>0 ? 0 : f(x)
set samples 200
set palette defined (0 "white", 1 "red", 2 "black")
set colorbox back user origin graph 0, graph 0 size graph 1, graph 1
unset cbtics
set xrange[0:15]
set xzeroaxis ls -1
set yrange[-0.2:0.5]
plot fabove(x) w filledcurves x2 fc rgb "white" not, \
fbelow(x) w filledcurves x1 fc rgb "white" not, \
f(x) w l lw 2 lc rgb "black", \
NaN palette, \
0 w l ls -1
### end of code
Result:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)