Writting the angle on the tip of the arrow in compass function
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
am using the compass function to plot the direction of (x,y) vectors and i changed the degrees from [0 45 90 ...] to [E NE N ...] using
pax = gca;
angles = 0:45:360;
pax.ThetaTick = angles;
labels = {'E','NE','N','NW','W','SW','S','SE'};
pax.ThetaTickLabel = labels;
so in addition to that i want to write the angle of the vector on the tip of the arrow can you help me out?
thanks.
댓글 수: 2
Walter Roberson
2018년 6월 10일
Are you using the polar.m hack I posted at https://www.mathworks.com/matlabcentral/answers/404890-specify-regions-in-compass?s_tid=prof_contriblnk#comment_576975 ? I ask because compass() normally produces a cartesian axes which does not have a ThetaTickLabel property.
채택된 답변
Walter Roberson
2018년 6월 11일
[th, r] = cart2pol(x, y);
text(th, r, sprintfc('%d',round(th(:)*180/pi)))
Here I round the angle to the nearest degree.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Polar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!