使用这个gnuplotting 条目作为灵感,我试图创建一个 3d 直方图,如下所示:

但是,在高角度视图下,depthorder不尊重:
用于生成绘图的 gnuplot(版本 5.2)命令包括:
set terminal pngcairo enhanced size 800,600
set output "cube_depthorder.png"
set cbrange [0:10]
set palette defined ( 1 '#ff4c4d', 2 '#ce4c7d', 3 '#ae559e', 4 '#df866d', 5 '#ffb66d', 6 '#ffe7cf', 7 '#cecece', 8 '#6d6d6d', 9 '#4c4c8e', 10 '#4c4cef' )
set view 60,45,1,1
set xrange [-0.09:1.99]
set xyplane at 0
set yrange [-0.1125:2.0125]
set pm3d at s depthorder border
unset colorbox
splot "-" binary record=(5,4) format="%double%double%double" using 1:2:3 notitle with lines dt solid linecolor rgb "black " , "-" binary record=(5,4) format="%double%double%double" using 1:2:3 notitle with lines dt solid linecolor rgb "black " , "-" binary record=(5,4) format="%double%double%double" using 1:2:3 notitle with lines dt solid linecolor rgb "black " , "-" binary record=(5,4) format="%double%double%double" using 1:2:3 notitle with lines dt solid linecolor rgb "black "
Run Code Online (Sandbox Code Playgroud)
正如所见, splot 命令包含四个条目。在将它们发送到 splot 之前,我尝试将这些条目从最高到最短进行排序,但这在depthorder.
我的怀疑是depthorder测量从四边形中心到情节视口的四边形,并按距离排序。有一个角度,高四边形的中心比较短的四边形更近,因此以不同的顺序绘制。
这种怀疑是正确的,还是这里有另一个问题?depthorder在这种情况下,是否有“正确”测量的解决方案?
对于那些希望重新创建这些图形的人,这里有一个包含等值线的数据文件(每条线是五个 (x,y,z) 点,每个立方体有 4 条线(2 个水平和 2 个垂直)和四个立方体) :
set terminal pngcairo enhanced size 800,600
set output "cube_depthorder.png"
set cbrange [0:10]
set palette defined ( 1 '#ff4c4d', 2 '#ce4c7d', 3 '#ae559e', 4 '#df866d', 5 '#ffb66d', 6 '#ffe7cf', 7 '#cecece', 8 '#6d6d6d', 9 '#4c4c8e', 10 '#4c4cef' )
set view 60,45,1,1
set xrange [-0.09:1.99]
set xyplane at 0
set yrange [-0.1125:2.0125]
set pm3d at s depthorder border
unset colorbox
splot "-" binary record=(5,4) format="%double%double%double" using 1:2:3 notitle with lines dt solid linecolor rgb "black " , "-" binary record=(5,4) format="%double%double%double" using 1:2:3 notitle with lines dt solid linecolor rgb "black " , "-" binary record=(5,4) format="%double%double%double" using 1:2:3 notitle with lines dt solid linecolor rgb "black " , "-" binary record=(5,4) format="%double%double%double" using 1:2:3 notitle with lines dt solid linecolor rgb "black "
Run Code Online (Sandbox Code Playgroud)
像这样的 3D 箱线图现在在 gnuplot 的开发版本中作为基本绘图类型得到支持。请参阅此在线示例:http : //gnuplot.sourceforge.net/demo_5.3/3dboxes.html
完成这项工作的诀窍是必须按照底部的 z 值对盒面进行排序。这是在新的命令变体中实现的
设置 pm3d depthorder 基础
我不知道在早期版本的 gnuplot 中有什么方法可以正确地做到这一点。