How do I rotate a plot, but keep axes locations at the origin

조회 수: 3 (최근 30일)
Ben B
Ben B 2016년 3월 27일
댓글: Ana Q 2016년 5월 13일
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
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
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.

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by