如何在gnuplot中绘制球体的表面? [英] How to plot the surface of a sphere in gnuplot?
问题描述
如何绘制白色球形表面?在三个维度上,半径应为1,以原点为中心.
How do I plot a white spherical surface? In three dimensions, radius should be 1, center at the origin.
我在球体上有分散的点数据.很难看清楚,因为球体另一端的点是一样可见的.因此,我想创建一个白色的球形背景",在该背景上可以清楚地看到数据.
I have scattered point data on the sphere. It is hard to look at it, since the points from the opposite end of the sphere are just as visible. Therefore I would like to create a white spherical "background" on top of which the data is clearly visible.
将一个坐标轴的范围限制为[0:1]是很麻烦的,因为它会切断我也想看的点的一半.
Restricting the range of one coordinate axis to [0:1] is cumbersome since it cuts off half the points at which I also want to look.
坦克!
推荐答案
Here is an example, borrowed from the gnuplot demo page. For a white sphere, replace yellow
with white
:
set parametric
set isosamples 50,50
set hidden
R = 1. # radius of sphere
set urange [-pi/2:pi/2]
set vrange [0:2*pi]
splot R*cos(u)*cos(v),R*cos(u)*sin(v),R*sin(u) w l lc rgb "yellow", \
"-" w p
1 0 0
-1 0 0
e
您会看到两个数据点中只有一个可见,而另一个隐藏在球体后面.
You can see that only one of the two data points is visible, while the other is hidden behind the sphere.
这篇关于如何在gnuplot中绘制球体的表面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!