Zoom a `CairoMakie` mesh plot

CairoMakie can do a 3d plot of a mesh; e.g.

using CairoMakie
save("mesh.png", plot([1. 0 0;0 1 0;0 0 1;0 0 0],[1 2 3;2 3 4]))

How is it possible to zoom such a picture? I tried calling zoom!(m.figure.scene, [0,0,0],10.,false))
(where m is the result of the plot command above), but this does not change anything when saving the plot to a file.

For zooming, it should be enough to call zoom!(scene, zoom_step) for your figure’s scene where it zooms in for values of zoom_step smaller than 1, and zooms out if greater than 1.

If you want to save the zoomed version of the plot to a file, you have to add scene.center = false before calling the save command, see: Saving Makie plot as is on the screen? - #2 by sdanisch

ERROR: MethodError: no method matching zoom!(::Scene, ::Float64)
Closest candidates are:
  zoom!(::Any, ::Any, ::Any, ::Bool) at /home/jerome/.julia/packages/Makie/Riyar/src/camera/camera3d.jl:258
 [1] top-level scope
   @ REPL[20]:1

Maybe this works with a more recent version? I have Makie v0.14.2. Thanks for the pointer for scene.center though! I would never have guessed that.

If you’re using an older version you may need to call update_cam!(scene, cameracontrols(scene)) after calling zoom. Also you should be passing ax.scene rather than fig.scene.

Yes, you are right, that was introduced in newer versions. So the syntax you had in the first post should be fine then.