How to show the first bar?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
William Ambrose
le 29 Oct 2020
Commenté : William Ambrose
le 29 Oct 2020
Hi there,
I have a problem I don't understand how to solve:
clear all
a = [ 0 0.0985 0 0 0 0;
0.0985 0.0245 0 0 0 0;
0.1229 0.0024 0 0 0 0;
0.1253 0.0062 0 0 0 0;
0.1315 0.0207 0 0 0 0;
0.1522 0.4889 0 0 0 0;
0.6411 0.6418 0 0 0 0;
1.2829 0.2781 0 0 0 0;
1.5610 0 4.5649 0 0 0;
6.1258 0 6.3255 0 0 0;
12.4513 0 6.7345 0 0 0;
19.1858 0 0 7.1922 0 0;
26.3780 0 0 4.1167 0 0;
30.4947 0 0 10.8742 0 0;
41.3689 0 0 0 6.3609 0;
47.7298 0 0 0 7.0327 0;
54.7624 0 0 0 3.2231 0;
57.9855 0 0 0 0 42.0145];
Put this in a bar chart:
graph1 = bar(a,'stacked','FaceColor','flat');
ax = gca; ax.YScale = 'log';
When I run this I get the graph which doesn't show the bar for the first column. If I zoom in on the graph I can find the bar
ax.YTick = [0.001 0.01 0.1 1 10 100];
and the labels
ax.YTickLabel = [{'10^{-3}'}
{'10^{-2}'}
{'10^{-1}'}
{'10^{0}' }
{'10^{1}' }
{'10^{2}' }];
Still doesn't help. I would be ever so grateful for input on how I could solve this as the very first observation XTick #1 is just as important as all the rest
0 commentaires
Réponse acceptée
Ameer Hamza
le 29 Oct 2020
Set the lower limit on y-axis too. For example
graph1 = bar(a,'stacked','FaceColor','flat');
ax = gca; ax.YScale = 'log';
ax.YTick = [0.001 0.01 0.1 1 10 100];
ax.YLim(1) = 1e-2;
3 commentaires
Ameer Hamza
le 29 Oct 2020
I am glad to be of help!
YLim of 0 does not work on log axes. If you set something like [0.01 102] it would have worked.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!