GNUPLOT:在球体表面绘图
GNUPLOT: Plotting on the surface of a sphere
我有一个依赖于 phi 和 theta 的函数,我想将其绘制在球体的表面上。
日期存储在包含以下列的 .txt 文件中:
1: x = R*sin(theta)*cos(phi)
2: y = R*sin(theta)*sin(phi)
3: z = R*cos(theta)
4: density
我使用以下 gnuplot 代码绘图:
set terminal wxt size 800,800
set mapping cartesian
set view equal xyz
set xlabel 'x'
set ylabel 'y'
set zlabel 'z'
splot "densityprofile_100.000.txt" u 1:2:3:4 with pm3d
pause -1
不幸的是,Gnuplot 似乎无法正确表示球体上的颜色。似乎有一些阴影,我无法摆脱;在这里查看图片:
当我用鼠标转动球体时,阴影越来越大,但没有完全消失的位置。
感谢任何帮助。
猜测,深度排序可能造成了一些麻烦。您是否尝试过 pm3d "hidden3d" 选项?
来自 pm3d 上的 gnuplot 帮助:
The option hidden3d takes as the argument a linestyle which must be
created by set style line .... (The style need not to be present when
setting pm3d, but it must be present when plotting). If set, lines are
drawn using the specified line style, taking into account hidden line
removal. This is by far more efficient than using the command set
hidden3d as it doesn't really calculate hidden line removal, but just
draws the filled polygons in the correct order. So the recommended
choice when using pm3d is
set pm3d at s hidden3d 100
set style line 100 lt 5 lw 0.5
unset hidden3d
unset surf
splot x*x+y*y
我通过添加以下行找到了问题的解决方案:
set pm3d depthorder
我有一个依赖于 phi 和 theta 的函数,我想将其绘制在球体的表面上。 日期存储在包含以下列的 .txt 文件中:
1: x = R*sin(theta)*cos(phi)
2: y = R*sin(theta)*sin(phi)
3: z = R*cos(theta)
4: density
我使用以下 gnuplot 代码绘图:
set terminal wxt size 800,800
set mapping cartesian
set view equal xyz
set xlabel 'x'
set ylabel 'y'
set zlabel 'z'
splot "densityprofile_100.000.txt" u 1:2:3:4 with pm3d
pause -1
不幸的是,Gnuplot 似乎无法正确表示球体上的颜色。似乎有一些阴影,我无法摆脱;在这里查看图片:
当我用鼠标转动球体时,阴影越来越大,但没有完全消失的位置。 感谢任何帮助。
猜测,深度排序可能造成了一些麻烦。您是否尝试过 pm3d "hidden3d" 选项?
来自 pm3d 上的 gnuplot 帮助:
The option hidden3d takes as the argument a linestyle which must be created by set style line .... (The style need not to be present when setting pm3d, but it must be present when plotting). If set, lines are drawn using the specified line style, taking into account hidden line removal. This is by far more efficient than using the command set hidden3d as it doesn't really calculate hidden line removal, but just draws the filled polygons in the correct order. So the recommended choice when using pm3d is
set pm3d at s hidden3d 100 set style line 100 lt 5 lw 0.5 unset hidden3d unset surf splot x*x+y*y
我通过添加以下行找到了问题的解决方案:
set pm3d depthorder