# Polarhistogram: how to create a "stacked" polar plot?

14 vues (au cours des 30 derniers jours)
Michael Venter le 12 Fév 2020
Modifié(e) : LO le 16 Mai 2023
I am looking to create the same effect that is created in a bar graph when it is "stacked" (each bar is made up of different colors). Is there a way to do this with the polarhistogram function?
Bar example( from documentation):
y = [2 2 3; 2 5 6; 2 8 9; 2 11 12];
bar(y,'stacked')
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Stephen Whitmarsh le 4 Oct 2021
Same here! Did you ever figure it out?

Connectez-vous pour commenter.

### Réponses (1)

LO le 16 Mai 2023
Modifié(e) : LO le 16 Mai 2023
Assuming you have 3 datasets with 3 different sets of angle measurements in degrees,
the following code will plot the polarhistograms of the 3 sets in a figure subplot of your choice (just edit the XXX according to your needs. If it's a single figure plot just remove the subplot line). The "trick" is just to add the hold on AFTER the first instruction. Somehow the polar axis elements need to be created first, before using "hold on".
subplot XXX
cla
polarhistogram(deg2rad(angles_in_degrees_1),24)
hold on
polarhistogram(deg2rad(angles_in_degrees_2),24)
polarhistogram(deg2rad(angles_in_degrees_3),24)
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Polar Plots dans Help Center et File Exchange

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by