Is there a way to use polarhistogram together with compass?

조회 수: 3 (최근 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 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