Wayne Tsai - 8 months ago 30

Linux Question

I am very new to GNU plot. Now, I am trying to plot a sphere and imported

`.txt`

**Using only**.`splot`

`set parametric ; unset pm3d ; splot [-pi:pi] [-pi/2:pi/2] cos(u)*cos(v), cos(u)*sin(v), sin(u) ; unset parametric ; splot "traj_3dtest.txt" u 2:3:4`

But there is onlyin output file.`splot "traj_3dtest.txt" u 2:3:4`

**Using**`multiplot`

`set parametric`

splot cos(u)*cos(v), cos(u)*sin(v), sin(u)

splot "traj_3dtest.txt" u 2:3:4

But the output shows that overlapped two plot, prnt_scrn_1

Here are also extra question: how to plot the spherical "surface"? I mean, I don't want a sphere with contours but a gray surface.

`# 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

Answer

If you want both in the same frame, but not overlapping:

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

From your `multiplot`

example, you'd have the two plots with separate axis:

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

or

```
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
```