sch*_*ard 0 plot gnuplot heatmap
我有一个函数,假设f(theta, phi) = sqrt(1 - (sin(theta)*sin(phi))**2) + 5 * sqrt(1 - (sin(theta)*cos(phi))**2)
我想在球体表面绘制颜色图。但是,我不知道如何splot
在不首先生成表中包含适当值的文件的情况下将这个函数输入到其中以实现此目的。
我怎样才能gnuplot
做到这一点?
您可以使用特殊文件名“++”来代替生成文件,请参阅help special
。我认为gnuplot 演示页面上的最后一个示例有您的用例。经过细微修改后简化:
xx(u, v) = cos(v) * cos(u)
yy(u, v) = cos(v) * sin(u)
zz(u, v) = sin(v)
f(theta, phi) = sqrt(1 - (sin(theta)*sin(phi))**2) + 5 * sqrt(1 - (sin(theta)*cos(phi))**2)
set parametric
set isosamples 121, 61
set samples 121, 61
set urange [-pi:pi]
set vrange [-pi/2:pi/2]
set border 4095
set view equal xyz
set xyplane 0
splot "++" using (xx($1,$2)):(yy($1,$2)):(zz($1,$2)):(f($1,$2)) with pm3d notitle
Run Code Online (Sandbox Code Playgroud)
这是结果:
请仔细检查球坐标的定义是否匹配。