Is there a way to use polarhistogram together with compass?

1 view (last 30 days)
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

Answers (1)

Vishal Neelagiri
Vishal Neelagiri on 3 Jan 2017
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 Comment
Pascal Geschwill
Pascal Geschwill on 4 Jan 2017
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.

Sign in to comment.

Categories

Find more on Polar Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!