how expand plots with different x-axis ranges
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Salvatore Savastano
il 9 Dic 2019
Modificato: Adam Danz
il 11 Dic 2019
Hi folks,
I have a problem with plot some distributions. I have two bar plots with different x-range values: one of them is contained in the other but it's smaller and so when I try to plot both only one is clearly visible while the other is shown as a "spike". How can I do to visualize both of them?
Togive a better idea about my question I have attached the two plot shown separately and I would like to have both on the same figure avoiding the "spike" effect.


Thank you in advance for your help

0 Commenti
Risposta accettata
Adam Danz
il 9 Dic 2019
Specify the edges for both histograms rather than letting that funciton choose the bins.
If the data from histrogram #2 only covers a very tiny range of the data from histogram #1, it may not be easy to see two different distributions plotted on the same axes.
If this advice doesn't solve the problem you'll have to provide a few lines that reproduces the problem (the data and the code you're using).
2 Commenti
Salvatore Savastano
il 9 Dic 2019
Modificato: Salvatore Savastano
il 9 Dic 2019
Adam Danz
il 10 Dic 2019
Modificato: Adam Danz
il 11 Dic 2019
Where does those first two inputs come from in bar() ?
Why not use histogram where you can specify the bar width. The suggestion in my answer would definitely make the bars visible for both distributions but there may be a lot fewer bars for 1 group than the other.
Alternatively you could scale the width parameter in bar(___,width)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Histograms in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!