Search code examples
gnuplotmaxima

How to set the Z range in plot3d in Maxima/WxMaxima?


I want to plot a 3D function in Maxima/WxMaxima:

u^2 - v^2

Using the manuals I put:

plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3], [grid, 100, 100],
    [mesh_lines_color,false])$

and this is what I get:

enter image description here

but I just want to get the positive values Z>0 . how can I set the range for Z?

This is strange that I can't find this anywhere in the documentation, because Maxima uses GnuPlot as a backend for plotting and there one can just easily set the zrange:

set zrange [0.0:5.0]


Solution

  • Use gnuplot_preamble:

    plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3], [grid, 100, 100],
    [mesh_lines_color,false], [gnuplot_preamble, "set zrange [0.0:5.0];"]);
    

    Or you can just add z limits:

    plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3], [z, 0, 5], [grid, 100, 100],
    [mesh_lines_color,false]);
    

    enter image description here