
How do I rotate a plot, but keep axes locations at the origin
3 次查看(过去 30 天)
显示 更早的评论
Hi all,
I'm attempting to rotate the following plot:

using the code below. I'd like to rotate it 40 degrees counterclockwise. I can almost do this using the 'camroll' below, but when I do this, the X and Y axes are no longer pass through the origin, as they currently do. When I do it using camroll, I get the below figure:

which is almost perfect, except that I'd like the X and Y axis to still pass through the origin, such that they'd make an "X" in the middle of the figure, rather than a box around the figure's perimeter.
Thanks!
1 个评论
Ana Q
2016-5-13
Hi,
I am having the same difficulty, I want to rotate image a), 5 degrees clockwise, but when I do it (I already used view and camroll to rotate it) the y axis changes to the right side (see b). I tried to change it again to the left side or to origin with YAxisLocation but it didn't work

.
Does anyone know of a way to do it, keeping the axis in its original position? By the way i'm using Matlab 2015b.
Thank you!
回答(1 个)
Image Analyst
2016-3-27
Try some of the other functions like camdolly() or view(), etc. Lots of camera functions to try. See the help.
Otherwise you can manually draw lines on the axes
line([0, 0], ylim(), 'Color', 'k', 'lineWidth', 2);
line(xlim(), [0, 0], 'Color', 'k', 'lineWidth', 2);
Sorry, though, using line() won't give you tick marks. It simply draws lines, not axes. The tick marks will remain at the outer edges.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!