D3. A surface
Goal: the same field as a surface in 3D, its height the value, seen from an angle.
gnuplot
# the same field as a surface: a mesh of its grid lines, hidden lines removed
set terminal svg size 600,420
set output 'pd03.svg'
set view 55, 35
set hidden3d
set xlabel 'x'; set ylabel 'y'; set zlabel '{/Symbol f}'
set ticslevel 0
splot 'field.dat' using 1:2:3 with lines title '{/Symbol f}(x,y)'Why it works
splotreads the grid's blocks as the lines of a mesh:with linesdraws its two families of grid lines.set view 55, 35turns the view: the rotation about the x axis, then about the vertical;set view 60, 30is gnuplot's default.set hidden3dremoves the lines behind the surface, gnuplot's way: the top of the mesh in one color, its underside in another.set ticslevel 0puts the base at the lowest z (gnuplot's default lifts the surface over the base).
Try this
set dgrid3d 30,30 qnorm 2before plotting scattered points: they are gridded first, then drawn as a surface.- From Fortran:
call fig%splot(x, y, z)with a grid, thenset_viewandset_hidden3d. set view equal xyz: the axes at their true lengths.
Pitfalls
- A file without the blank lines between rows is a cloud of points, not a grid:
splotthen draws lines along the file order. Write the blank lines, or grid it withset dgrid3d. set hidden3dneeds a grid; it does not apply to scattered points.
Reference: 3D plots, 3D views. Next: D4. Colored and lit surfaces.