File Exchange

image thumbnail


version (3.8 KB) by Dirk-Jan Kroon
Easily zoom, pan, rotate the camera in a Matlab axis with left/center/right mouse button


Updated 01 Jul 2010

View License

This function MOUSE3D enables mouse camera control on an certain figure axes.

Enable mouse control with mouse3d(axis-handle) or just mouse3d

Left : Rotate
Right : Zoom
Center : Pan
'r' : Change mouse rotation from inplane to outplane
'i' : Go back to initial view

[X,Y,Z] = peaks(30);
colormap hsv
% Enable mouse control

Cite As

Dirk-Jan Kroon (2020). mouse3d (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (11)

Works well with pcshow() in R2018, but not with pcshow() in R2019. Will you make any update?

deru jian


Would be nice if
Left: Free
Center: Rotate
Scroll Wheel: Zoom
Right: Pan


Would be cool if
Left: Free
Center: Rotate
Scroll Wheel: Zoom
Right: Pan

very nice!

note to turn off rotate3d before calling mouse3d.

Very nice tool, the centered rotation works well when zoomed in, compared to the default MATLAB rotation tool.

Janos Marki

Excellent tool, Matlab should be shot for not having implemented this on their own years ago. Good work, Dirk-Jan!


I think this is the tool what I need exactly!
But I found if the code in line 187 was changed to:
Rz=[cosd(r(3)) sind(r(3)) 0 0; -sind(r(3)) cosd(r(3)) 0 0; 0 0 1 0; 0 0 0 1];
the rotate will be better.
One more thing, could the function that use mouse wheel to zoom be added to the tool? :-)

This is really cool.

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux