linux - GNUPlot : How to plot a sphere and imported file on the same frame?

标签 linux gnuplot

我对 GNU plot 很陌生。现在,我正在尝试绘制一个球体并在同一帧 导入.txt 文件。但是,我想不出合适的方法。这是我的尝试:

  1. 仅使用 splot

    设置参数;取消设置 pm3d ; splot [-pi:pi] [-pi/2:pi/2] cos(u)*cos(v), cos(u)*sin(v), sin(u) ;取消参数化;绘制“traj_3dtest.txt”u 2:3:4

    但是输出文件中只有splot "traj_3dtest.txt"u 2:3:4

  2. 使用 多图

    设置参数 绘制 cos(u)*cos(v), cos(u)*sin(v), sin(u) 绘制“traj_3dtest.txt”u 2:3:4

    但输出显示两个图重叠,prnt_scrn_1

这里还有一个额外的问题:如何绘制球形“表面”?我的意思是,我不想要一个有轮廓但有灰色表面的球体。

注意数据文件格式

# T X Y Z Vx Vy Vz 1.00 -0.429 -0.847 0.314 -.09755 -.29510 -.15748 2.00 -0.429 -0.848 0.314 -.09752 -.29504 -.15750 3.00 -0.429 -0.848 0.313 -.09749 -.29497 -.15752 4.00 -0.429 -0.848 0.313 -.09746 -.29491 -.15755

最佳答案

如果您希望两者在同一帧中,但不重叠:

splot cos(u)*cos(v), cos(u)*sin(v), sin(u), "traj_3dtest.txt" u 2:3:4

在您的multiplot 示例中,您将得到两个轴不同的图:

set multiplot layout 2,1
splot cos(u)*cos(v), cos(u)*sin(v), sin(u)
splot "traj_3dtest.txt" u 2:3:4

set multiplot

set origin 0,0.5
set size 1,0.5
splot cos(u)*cos(v), cos(u)*sin(v), sin(u)

set origin 0,0
set size 1,0.5
splot "traj_3dtest.txt" u 2:3:4

关于linux - GNUPlot : How to plot a sphere and imported file on the same frame?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38288343/

相关文章:

c++ - 如何从可执行文件中打开 bash?

plot - 从文件中进行 Gnuplot 3D 绘图,x、y 和 z 刻度上的详细值不够

plot - 用连接线绘制数据点,但留有空隙

formatting - gnuplot - 格式化绘图的标题(字母上方的条形)

linux - 如何在Linux(Debian/Ubuntu)中正确注册特定的GCC版本?

Linux 查找和替换

linux - 如何用 sed 替换未知字符 <?> ?

Linux/Windows 中的 C/C++ 内存使用 API

gnuplot - 设置轴上数值数字的字体大小

使用 xdate 绘制直方图时的 Gnuplot 错误