网上有很多资源可以教你如何绘制断轴的二维图,例如http://www.phyast.pitt.edu/~zov1/。基本上使用的策略是使用多图模式绘制两个图,并将它们组合在一起。
但是,我想要做的是打破 Z 轴,考虑这两个曲面:
由于两个表面之间的能隙很大,在这个图中地能面几乎是“平坦的”,但如果我们单独绘制地能面,我们可以看到它根本不是“平坦”的:
有没有办法打破Z轴让Gnuplot显示更多表面细节?multiplot 在这里不起作用,因为它是一个 3d 绘图。
您可以向下移动上表面并手动重新标记 z 抽动。以这张图为例:
让我们找出一些 gnuplot 魔法:
# Make sure that there are no data points exactly at the corners
# of the xy plane (it affects the vertical borders)
set xrange [-1.001:1.001]
set yrange [-1.001:1.001]
zmin = -2
zmax = 5
dz = zmax - zmin
set zrange [zmin:zmax]
# Remove vertical borders
set border 15
# Some functions to plot
f(x,y)=x**2+y**2+10.
g(x,y)=-x**2-y**2
# Draw vertical borders by hand leaving empty space where the
# axis is broken. I have used variables zmin etc. for transparency
set for [i=-1:1:2] for [j=-1:1:2] arrow \
from i,j,zmin-dz*0.5 to i,j,1 lw 1 nohead
set for [i=-1:1:2] for [j=-1:1:2] arrow \
from i,j,2 to i,j,zmax lw 1 nohead
# Draw zig-zag line to denote broken axis
set for [i=-1:1:2] for [j=-1:1:2] arrow \
from i,j,1 to i-0.05,j,1+0.25 lw 1 nohead
set for [i=-1:1:2] for [j=-1:1:2] arrow \
from i-0.05,j,1+0.25 to i+0.05,j,1+0.75 lw 1 nohead
set for [i=-1:1:2] for [j=-1:1:2] arrow \
from i+0.05,j,1+0.75 to i,j,2 lw 1 nohead
# Add ztics by hand. Use "for" if you have many tics
set ztics (-2, 0)
# We print the z value - 7, which is the amount we are shifting the
# upper surface
set ztics add ("10" 3, "12" 5)
# Plot shifting the surface
splot f(x,y)-7, g(x,y)
Run Code Online (Sandbox Code Playgroud)
请注意,用 定义的新边界set arrow将绘制在曲面后面。如果您希望某个特定的位于前面,请将其从set for循环中取出并添加front关键字。