How to add a horizontal line in a bar plot????
55 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Dear all,
i use the command bar for a plot. I want to insert a horizontal line in a bar plot at y = 30. How can I do that? Thank you!
0 Commenti
Risposta accettata
Azzi Abdelmalek
il 1 Feb 2013
Modificato: Azzi Abdelmalek
il 1 Feb 2013
xlim=get(gca,'xlim');
hold on
plot(xlim,[30 30])
2 Commenti
Image Analyst
il 1 Feb 2013
Isn't the first line unnecessary? xlim is already the x limits - you don't have to call get() to retrieve it, it's already ready to be used "as is". xlim is actually a function itself that returns the x limits.
Più risposte (1)
Vivian Hauss
il 19 Lug 2016
Modificato: Vivian Hauss
il 19 Lug 2016
A bit shorter:
hline(30,':k','This Line is horizontal')
1 Commento
Vedere anche
Categorie
Scopri di più su Bar Plots 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!