Writting the angle on the tip of the arrow in compass function

5 ビュー (過去 30 日間)
Ahmed Siddig
Ahmed Siddig 2018 年 6 月 10 日
コメント済み: Ahmed Siddig 2018 年 6 月 11 日
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
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.
Ahmed Siddig
Ahmed Siddig 2018 年 6 月 11 日
Am using the final piece of code you provided me with
set(gca, 'ThetaLim', [225, 315])
thank you very much for that. i have the angle value (V) i just want to make it on the tip of the arrow. much appreciated.

サインインしてコメントする。

採用された回答

Walter Roberson
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.
  1 件のコメント
Ahmed Siddig
Ahmed Siddig 2018 年 6 月 11 日
Thank you so much MR. Roberson. Sorry for troubling you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by