Is there a way to use polarhistogram together with compass?

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Polar Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by