【问题标题】:Broken z-axis in splotsplot 中损坏的 z 轴
【发布时间】:2016-03-07 17:16:09
【问题描述】:

网上有很多资源可以教你如何绘制带有断轴的二维图,例如http://www.phyast.pitt.edu/~zov1/。基本上使用的策略是使用多图模式绘制两个图,并将它们组合在一起。

但是,我想做的是打破 Z 轴,考虑这两个表面:

由于两个表面之间的能量间隙很大,所以在这个图中地能表面几乎是“平坦的”,但如果我们单独绘制地能表面,我们可以看到它根本不是“平坦”的:

有没有办法打破 Z 轴让 Gnuplot 显示表面的更多细节? multiplot 在这里不起作用,因为它是 3d 绘图。

【问题讨论】:

  • 你为什么不喜欢并排情节?即使你成功打破z轴,两者也会重叠,一旦混合起来就很难注意到差异

标签: gnuplot


【解决方案1】:

您可以向下移动上表面并手动重新标记 z tics。以这张图为例:

让我们来研究一下 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)

请注意,使用set arrow 定义的新边框将绘制在表面后面。如果您希望某个特定的位于前面,请将其从 set for 循环中取出并添加 front 关键字。

【讨论】:

  • 不错的之字形线法。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-04-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多