How can I change the transparency of a bar graph when I have two differnt data sets?
Afficher commentaires plus anciens
I am plotting 2 series of data with an arbitrary bin size (so the histogram plot looks really bad). For example:
close all
ages = [3 12 24 15 5 74 23 54 31 23 64 75];
binranges = [0 10 25 50 75];
binranges1 = [0 5 25 50 75];
[bincount,ind] = histc(ages,binranges);
[bincount1,ind1] = histc(ages,binranges1);
figure
bar(binranges,bincount);
hold on;
bar(binranges1,bincount1,'r');
I would like the image to look more like a histogram (shown next) but the histogram width looks really bad (so the smaller bin size affects the overall shape of the graph).
ages = [3 12 24 15 5 74 23 54 31 23 64 75];
binranges = [0 10 25 50 75];
binranges1 = [0 5 25 50 75];
histogram(ages,binranges);
hold on;
histogram(ages,binranges1);
I was thinking I would be able to change the facealpha property on the bar series plot but that is no longer the case. I was hoping to make the histogram have equal bin width graphically, even though the bins themselves are different sizes.
1 commentaire
Walter Roberson
le 12 Fév 2016
Which MATLAB version are you using? R2014b had no way to set the bar alpha; R2015b does have a way to set the alpha; I would need to check the records to see if R2015a had it.
Réponses (0)
Catégories
En savoir plus sur Bar Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!