简体   繁体   English

如何在gnuplot中绘制球体的表面?

[英]How to plot the surface of a sphere in gnuplot?

How do I plot a white spherical surface? 如何绘制白色球面? In three dimensions, radius should be 1, center at the origin. 在三维空间中,半径应为1,以原点为中心。

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. 将一个坐标轴的范围限制为[0:1]是很麻烦的,因为它会切断我想要查看的点的一半。

Tanks! 坦克!

Here is an example, borrowed from the gnuplot demo page . 这是一个例子,借鉴了gnuplot演示页面 For a white sphere, replace yellow with white : 对于白色球体,将yellow替换为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. 您可以看到两个数据点中只有一个可见,而另一个隐藏在球体后面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM