Creating a polar bar chart or circumplex chart (not a histogram)

5 views (last 30 days)
I’m trying to create a polar bar chart (or circumplex chart) similar to the one created in R by Conor McLaughlin at
Essentially, I’m trying to plot a bar chart and then convert it to a polar coordinate system. I’ve tried using polarhistogram and rose, but both appear to bin the data and create a histogram, rather than plotting the raw data in each pre-existing group.
Is there a way to use bar to create a bar chart and then change the coordinates to polar? Or is there a way to make sure polarhistogram only plots raw data without doing statistics?
P.S. My data looks something like this, with four groups showing different soil particle size classes and percentage of the total concentration of a given metal associated with each size class.
Particle Size Class Percent of total concentration
A 10
B 15
C 60
D 15

Accepted Answer

Adam Danz
Adam Danz on 1 Jul 2022
Edited: Adam Danz on 1 Jul 2022
If you have data suitable for a bar plot and, therefore, you don't need to compute the bins and bar heights, see polarhistogram('BinEdges',edges,'BinCounts',counts)
Since polarhistogram only allows setting a uniform color, a workaround is to plot each segement in a loop. That will require computing the bin counts ahead of time.
I've changed the face and edge colors and the transparency level to match the OP's sample image but I recommend removing the FaceAlpha line so you can make use of the polar grid.
theta = [0.1 1.1 5.4 3.4 2.3 4.5 3.2 3.4 5.6 2.3 2.1 3.5 0.6 6.1];
nbins = 6;
thetaBins = linspace(0,2*pi,nbins+1);
counts = histcounts(theta, thetaBins);
tcl = tiledlayout(1,2);
pax = polaraxes(tcl);
pax.Layout.Tile = 2;
faceColor = turbo(nbins); % choose your face colors
for i = 1:numel(counts)
polarhistogram(pax,'BinEdges',thetaBins(i:i+1),'BinCounts',counts(i), ...
'FaceColor', faceColor(i,:), ...
'FaceAlpha', 1, ... % to match image in OP's question
'EdgeColor','w') % to match image in OP's question

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by