MATLAB: How to use the Zooming and Panning tools on a 2-D plot derived from a 3-D plot

2d3daxisboxMATLABplotrescalerubberbandzoom

I have a set of 3D data that I visualize using PLOT3. I then change the view of the axes, to see a particular plane (in this case, the YZ plane) as follows:
x=1:10;
y=1:10;
z=x.^2;
plot3(x,y,z)
xlabel('x')
ylabel('y')
zlabel('z')
view(90,0);
When I use the Zooming or Panning tools, they behave like the axes view is 3D, instead of 2D.

Best Answer

The ability to use 2D plot functionalities like Zooming and Panning on 3D plots is not currently available in MATLAB.
To work around this issue, create a new 2-D plot with just the Y and Z data rather than choosing a 2D view of the original 3D plot. So for the above example, we would have
x=1:10;
y=1:10;
z=x.^2
plot3(x,y,z)
xlabel('x')
ylabel('y')
zlabel('z')
view(90,0);
figure
plot(y,z);
xlabel('y');
zlabel('z');
You can now use the Zooming and Panning tools on this plot.
Related Question