1

I have been using Gnuplot to display 3D-mesh graphs (surface graphs) for a while. I am now striving to get Gnuplot 3D-mesh cell values displayed by placing the mouse cursor (pointer) over it. I have seen the cell fourth dimension (color intensity value) can get displayed. Could anybody help?

This is my GNUPLOT code

set cbrange [0.0:.2]
set palette defined (0 'white', 1 'midnight-blue')
set pm3d
set contour surface
set cntrparam levels incremental 0, 50, 1000
set xrange [0:1300]
set yrange [0:1500]
set zrange [0:1000]
set xyplane at 0
set view 9, 88, 2.3
set view equal xy

splot '-' using 1:2:3:4 notitle with lines lw .3 lc rgb 'black'

I appreciate your comments

Javero

Javero
  • 11
  • 2

1 Answers1

2

Probably you are looking for something like this? The points for hypertext anchor are made with pointsize 2 (for easy capture) and fully transparent, i.e. invisible (whatever) color 0xff...... (scheme 0xaarrggbb).

Check help hypertext.

Script:

### show hypertext in 3D
reset session

# create some test data
set samples 16
set isosamples 16
set table $Data
    f(x,y)=(sin(1.3*x)*cos(.9*y)+cos(.8*x)*sin(1.9*y)+cos(y*.2*x))+3
    splot '++' u 1:2:(f($1,$2))
unset table

set palette defined (0 'white', 1 'midnight-blue')
set pm3d hidden noborder depthorder
set xyplane relative 0
set key noautotitle

splot $Data u 1:2:3 w pm3d, \
         '' u 1:2:3:(sprintf("%.2f",$3)) w labels hypertext \
            point pt 7 ps 2 lc rgb 0xff123456
### end of code

Result: (screen capture from wxt terminal)

enter image description here

theozh
  • 22,244
  • 5
  • 28
  • 72
  • Clever! And yes, you could print the value of a 4th column instead of z. – Ethan Jul 08 '22 at 04:36
  • @Ethan Well, thanks to the possibilities of gnuplot and those who are developing and maintaining it ;-). I couldn't find an easy way to create grid data _and_ add a 4th column for the test data via `splot ... w table`. Probably, I would have to use `set print` and a `do for` loop. – theozh Jul 08 '22 at 04:51
  • Thank you theozh. This is exactly what I am trying to do. However I now realize that i need to look into it to find out the specifics on using hypertext within "splot". I am actually coding a C++ program which displays a really large Gnuplot 3D surface. – Javero Jul 11 '22 at 21:05
  • @Javero The above example has only 16x16=256 points. I haven't tested how it would work with 100x100 or 1000x1000 datapoints. Not sure, whether it might get extremely slow or probably extremely memory intensive. – theozh Jul 12 '22 at 09:55