2016-03-06 75 views
2

有大量資源可以在線教你如何繪製帶有斷軸的二維圖,例如, http://www.phyast.pitt.edu/~zov1/。基本上使用什麼策略是使用多槽模式繪製兩個圖,並將它們組合在一起。瑕疵中的z軸

不過,我希望做的是打破了Z軸,考慮這兩個表面:

Potential Energy Surface Example

因爲兩個表面之間的能隙大的,地面能量表面幾乎是「平「在這個情節,但如果我們只繪製地面能量表面,我們可以看到它是不是‘平’的說法:

enter image description here

是否有打破Z軸做出的Gnuplot的一種方式顯示錶面的更多細節?多槽在這裏不起作用,因爲它是一個3d圖。

+0

爲什麼你不想並排情節?即使您成功打破了z軸,兩者也會疊加,一旦混合出現差異將很難發現它 – bibi

回答

4

您可以將上表面向下移動,並手動重新標記標籤。以這個數字作爲一個例子:

enter image description here

讓我們的工作出了一些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) 

enter image description here

注意與set arrow定義新的邊界將表面背後繪製。如果您希望某個特定的人位於前面,請將其從set for循環中取出,並將front關鍵字添加到該循環中。

+0

不錯的鋸齒形線條法。 – bibi