MATLAB: Does the ROTATE function not work on contour plots in MATLAB 7.0 (R14)

contourMATLABrotate

When I execute the following code in MATLAB 7.0 (R14):
[X,Y] = meshgrid(-2:.2:2,-2:.2:3);
Z = X.*exp(-X.^2-Y.^2);
[C,h] = contour(X,Y,Z);
rotate(h,[0 0 1],45)
The contour plot is not rotated.

Best Answer

To workaround the issue, you may use the “Rotate” icon in the figure toolbar to rotate the plot.
Alternatively, use the children handle. This will enable the resulting contour plot to be rotated:
[X,Y] = meshgrid(-2:.2:2,-2:.2:3);
Z = X.*exp(-X.^2-Y.^2);
[C,h] = contour(X,Y,Z);
rotate(get(h,'children'),[0 0 1],45)