Is there a way to use polarhistogram together with compass?

1 回表示 (過去 30 日間)
Pascal Geschwill
Pascal Geschwill 2016 年 12 月 31 日
コメント済み: Pascal Geschwill 2017 年 1 月 4 日
Hi guys,
I have a vector of angles given in radians whose distribution I would like to visualize using polarhistogram. Additionally I want to show the mean of these angles in red using the compass function in the same plot. This is where I run into trouble since these two functions produce polar and cartesian axes, respectively which apparently are not compatible.
I can work around this by using the rose function instead of polarhistogram but there are far less formatting options included. Would anyone of you have an idea how to solve this problem?
Thanks in advance

回答 (1 件)

Vishal Neelagiri
Vishal Neelagiri 2017 年 1 月 3 日
You can extract the handle of the line object used to create the 'rose' plot and then use the line formatting properties to modify the plot. For example:
theta = [0.4 1.4 3.1 2.3 0.4 2.5 3.9 2.8 2.3 1.6 4.6 4.5 6.1 3.9 5.1];
h = rose(theta,10)
h.LineWidth = 2;
You can refer to the following documentation link for various line formatting properties:
https://www.mathworks.com/help/matlab/ref/chartline-properties.html
  1 件のコメント
Pascal Geschwill
Pascal Geschwill 2017 年 1 月 4 日
Hi Vishal,
thank you for your help. I'll give that a try. I worked around my problem in the meantime by plotting a line in polar coordinates indicating the mean angle. It doesn't look as nice as an arrow but this is just aesthetics at that point.

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

カテゴリ

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