MATLAB Answers

Bar graph start value

41 views (last 30 days)
The bar command always draw bars starting from 0. If the value to plot is positive, the bar extends upwards from 0, and if the value is negative, the corresponding bar extends downward. Is there a way to change the value the bars start at? For example, I would like the bars to start at -5 (so that bars with values at -2, -1 extend upward).
Thanks, David


Sign in to comment.

Accepted Answer

Oleg Komarov
Oleg Komarov on 7 Sep 2011
bar([-5 -2 2 4 5],'BaseValue',-5)


David C
David C on 7 Sep 2011
Perfect. Thanks Oleg. I should have looked in the barseries properties before asking this question.
Oleg Komarov
Oleg Komarov on 7 Sep 2011
I didn't know either before you asked.

Sign in to comment.

More Answers (0)

Translated by