only allow rotation of one subplot
I have two subplots. One is 3D and rotation is useful, but the 2nd is 2D and I keep accidentally rotating it which is really annoying. Is it possible to only allow rotation of one subplot开发者_开发技巧?
I believe you are turning on plot rotation using the
button on the figure toolbar. Instead of pressing this button, which turns on rotation for all axes in the figure window, you can simply call the function ROTATE3D in your code:rotate3d(hAxes); %# Turn on rotation for axes with handle hAxes
Where hAxes
is the handle of the axes (i.e. subplot) you want to turn rotation on for. An axes handle is usually returned by functions that create them (like AXES or SUBPLOT), or it can be found using the functions GCA (for the currently active axes) or FINDOBJ.
Here are a couple alternative ways to call ROTATE3D to turn on rotation, each of which achieves the same as the above line of code:
%# Option 1:
rotate3d(hAxes,'on'); %# Explicitly state 'on' (no argument will simply toggle)
%# Option 2:
h = rotate3d(hAxes); %# Create a rotate mode object with handle h for hAxes
set(h,'Enable','on'); %# Enable rotation
精彩评论