How to plot a Bar Graph without a uniform spacing on the horizontal axis
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Tarek Hajj Shehadi
il 10 Mag 2021
Commentato: Tarek Hajj Shehadi
il 10 Mag 2021
Hello, suppose I have a bar graph where I am testing some data with
How can I have these four values spaced equally on the horizotnal axis?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/613250/image.png)
0 Commenti
Risposta accettata
KSSV
il 10 Mag 2021
Modificato: KSSV
il 10 Mag 2021
You can plot the values by index and show the respective values uisng text.
Example:
x = [5 10 100 1000] ;
y = rand(size(x)) ;
bar(y)
text(1:length(x),y,num2str(x'),'vert','bottom','horiz','center');
Or, use xticklabels and show the values at the x-axes.
Example:
x = [5 10 100 1000] ;
y = rand(size(x)) ;
bar(y)
xticklabels(x)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graph and Network Algorithms 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!