文件和参数化球体的gnuplot曲线

文件和参数化球体的gnuplot曲线,gnuplot,Gnuplot,我试图在三维空间中绘制一条来自文件的曲线和一个由参数化条目构成的球体 这个想法是绘制地球和卫星轨道图 动态观察是在一个文件x y z中定义的,gnuplot命令只是 splot 'file.txt' u 1:2:3 title 'Orbit element 1' with lines 轨道卫星: 我找到了一个描绘地球的剧本 #color definitions set border lw 1.5 set style line 1 lc rgb '#000000' lt 1 lw 2 set

我试图在三维空间中绘制一条来自文件的曲线和一个由参数化条目构成的球体

这个想法是绘制地球和卫星轨道图

动态观察是在一个文件x y z中定义的,gnuplot命令只是

splot 'file.txt' u 1:2:3 title 'Orbit element 1' with lines
轨道卫星:

我找到了一个描绘地球的剧本

#color definitions
set border lw 1.5
set style line 1 lc rgb '#000000' lt 1 lw 2
set style line 2 lc rgb '#c0c0c0' lt 2 lw 1
unset key; unset border 
set tics scale 0
set lmargin screen 0
set bmargin screen 0 
set rmargin screen 1
set tmargin screen 1 

set format ''
set mapping spherical
set angles degrees

set xyplane at -1
set view 56,81

set parametric

set isosamples 25
set urange[0:360]
set vrange[-90:90]
r = 0.99
splot r*cos(v)*cos(u),r*cos(v)*sin(u),r*sin(v) with lines linestyle 2,'world.dat' with lines linestyle 1
unset parametric

不幸的是,我不能将splot与数据文件和splot与参数化文件混合使用

欢迎提出任何建议!
谢谢

为了生成下面的图,我使用了本文中链接的数据。现在,如果我们想把几个数据源合并成一个图,我们需要将其中一个转换成一个公共坐标系。如果卫星数据是笛卡尔x、y、z坐标系,也许最简单的解决方案就是将世界地图转换成笛卡尔坐标系

这可以按如下所示完成。参数
R
表示Gnuplot绘制世界地图的球体表面的半径。它应该略大于
r
,以便
hidden3d
工作。
world_110m.txt
文件中的列具有经度(第一列)和纬度(第二列)的含义,因此转换为
(R*cos($1)*cos($2)):(R*sin($1)*cos($2)):(R*sin($2))
。在文件
input.pnts.dat
中,我刚刚生成了椭圆上点的坐标,
a=1.6
b=1.2
绕x轴旋转45度(逆时针)。对于真实的卫星数据,需要通过除以地球半径来重新缩放坐标,即使用
($1/Re):($2/Re):($3/Re)
而不是
1:2:3
,其中
Re
表示数据的半径(根据问题中的第一个图判断,可能是米)

然后给出:

它们的比例相同吗?在这两个例子中你不是都使用了一个文件吗?第一张海报做得很好。。我希望这封信能尽快通知其他人+1.
set terminal pngcairo
set output 'fig.png'

set xr [-2:2]
set yr [-2:2]
set zr [-2:2]

#color definitions
set border lw 1.5
set style line 1 lc rgb '#000000' lt 1 lw 2
set style line 2 lc rgb '#c0c0c0' lt 2 lw 1

unset key; unset border; set tics scale 0

set format ''
set angles degrees

set xyplane at -1
set view 56,81

set lmargin screen 0
set bmargin screen 0 
set rmargin screen 1
set tmargin screen 1 

set parametric
set isosamples 25
set urange[0:360]
set vrange[-90:90]
r = 0.99
R = 1.00

set hidden3d

#since we are using Cartesian coordinates, we don't want this
#set mapping spherical

splot \
  r*cos(v)*cos(u),r*cos(v)*sin(u),r*sin(v) with lines linestyle 2, \
  'world_110m.txt' u (R*cos($1)*cos($2)):(R*sin($1)*cos($2)):(R*sin($2)) w l lw 2 lc rgb 'black', \
  'input.pnts.dat' u 1:2:3 w l lw 2 lc rgb 'red'