1
votes

I need to plot a 3d surface (from a file) and then plot a line (from a different file) over that surface. I've found a related thread (Gnuplot: Plotting a path over a surface) but the suggested answer was something that I have already tried (and it didn't work).

The surface is a 3D potential energy surface and the line is a trajectory over that surface. The line describes how the system I'm studying evolves over the surface.

I'm currently doing this:

splot "trajectory.dat" using 4:6:10 title "{/Helvetica=23 trajectory}"  with lines lt -1
set pm3d
set hidden3d

splot   "surface.dat" using 1:3:7 title "{/Helvetica=23 surface}"

but all I get is the surface and no trajectory. The trajectory briefly flashes up when I plot it from the script but then the surface comes over on top of it and that's all I can see. No sign of the trajectory even on rotating and re-orienting the surface.

I've tried reversing the plot order (surface first and then trajectory) but that doesn't work either.

I also tried putting a z-axis offset to the trajectory to check that it was not a case of the surface being plotted on top of the trajectory. This failed too.

Any ideas on how to proceed? I've trawled through the gnuplot help files and there's no example or case that helps. I'm well and truly stuck. Please help! I appreciate any input very much.

1

1 Answers

1
votes

You must have a single splot call, like it is also done in the answer to Gnuplot: Plotting a path over a surface:

set pm3d
set hidden3d
splot "trajectory.dat" using 4:6:10 title "trajectory"  with lines lt -1,\
      "surface.dat" using 1:3:7 title "surface"

Otherwise, if you are not in multiplot mode, the second splot creates a completely new graph.