How to plot the surface of a sphere in gnuplot?

a 夏天 提交于 2020-01-15 10:36:44

问题


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.

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.

Tanks!


回答1:


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.



来源:https://stackoverflow.com/questions/47572292/how-to-plot-the-surface-of-a-sphere-in-gnuplot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!