Imperio
Imperio

Reputation: 13

Gnuplot: How to plot points with pm3d?

I want to plot a data file with 16 given points using pm3d in gnuplot, but I also want all this given points to be shown on the plot. That's how my data file (xyz.dat) looks like:

# X     Y     Z
  0     0     0.632  
  0     5     0.46
  0     10    0.37
  0     50    0.41
  5     0     0.95
  5     5     0.66
  5     10    0.59
  5     50    0.5
  10    0     1.5
  10    5     0.96
  10    10    0.77
  10    50    0.5
  50    0     1.5
  50    5     1.5
  50    10    1.5
  50    50    0.98

Here is my code so far:

 set ticslevel 0  
 set dgrid3d 30,30  
 set palette defined (0 "blue", 0.75 "white", 1.4 "red")  
 set style lines 100 lt 5 lw 0.5  
 set pm3d hidden3d 100  
 set grid  
 set view 74,216  
 unset key  
 splot 'xyz.dat' using 1:2:3 with pm3d

This produces the following output:

Output

I'm really glad with this result, but I want to make this 16 given points from the data file clearly visible on this plot, but I become just something like that:

Outputs with points

I want this 16 points (and only this 16 points) to be clearly shown on the "Output"-picture, but I don't know, how to change my code for that. Thank you in advance!

Upvotes: 1

Views: 5345

Answers (1)

Ethan
Ethan

Reputation: 15093

The difficulty you are encountering is not because of pm3d but rather because you have enabled auto-generation of gridded surfaces via the command set dgrid3d. Any plot style that can become a surface is caught by this. You can work around this by using a non-surface plot style like with labels. Of course you don't have any actual label text, but you can still draw a point indicating the label position. Your plot command becomes

splot 'xyz.dat' using 1:2:3 with pm3d, \
      'xyz.dat' using 1:2:3:("") with labels point pt 7

Upvotes: 1

Related Questions