Can I plot multiple polar histograms together?

조회 수: 21 (최근 30일)
Heidi Hirsh
Heidi Hirsh 2019년 2월 6일
답변: Heidi Hirsh 2019년 2월 14일
I am trying to plot 13 weekly polar histograms to convey wind data. I tried using subplot but it doesn't seem to like the histograms. Is there a different function I should use. I want something like this (forgive the poor ppt execution!): polarhistall.png

채택된 답변

Shane L
Shane L 2019년 2월 6일
The problem is that subplot creates axes, whereas polarhistogram requires polar axes (see polaraxes). I don't know of an equivalent function to subplot for creating polar axes, but you could try this workaround: use subplot to autmoatically create axes in a grid, then create polar axes using the position of each subplot, and then delete the original axes. See below for an example on a random dataset:
theta = randn(1000,1); % random dataset
for ii = 1:13
axesHandle(ii) = subplot(3,5,ii);
polarAxesHandle(ii) = polaraxes('Units',axesHandle(ii).Units,'Position',axesHandle(ii).Position);
delete(axesHandle(ii));
polarhistogram(polarAxesHandle(ii),theta+2*pi*rand)
end
This code produces the following:
PolarAxesSubplot.png
You can then add a legend and format the appearance of the polar axes.

추가 답변 (1개)

Heidi Hirsh
Heidi Hirsh 2019년 2월 14일
A friend showed me this page and it works too!
https://www.mathworks.com/help/matlab/ref/subplot.html#bvnckvm-1

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by