MATLAB : problem with bar graph

2 views (last 30 days)
Sarah Guiffray
Sarah Guiffray on 12 Mar 2015
Answered: dpb on 12 Mar 2015
Hello,
I have a bar graph with 2 different data (each with a different color as you can see on the picture). I would like to move the x-axis so it crosses at y=-100 (for example). So if a data = -40, I would like to have a bar from -100 to -40.
An other question : is it possible to write each value of the x-axis vertically (because with all the values, we can't see anything).
Thank you in advance,
Best regards,

Accepted Answer

dpb
dpb on 12 Mar 2015
For the reference, use
hBar=bar(X,Y,'basevalue',-100);
Doesn't move the axes but is probably the effect you're looking for.
Unless it's been introduced since R2012b, there is no 'textangle' property for the tick labels; there have been advances in using the TeX interpreter; you can always try to gussy it up via that option; I've not tried rotation to see if the builtin interpreter knows it or not.
Failing that, you can always use text and label the ticks manually. I'd guess looking at the image you've got so many that you simply don't have room for all of them irregardless of orientation but only trying it out will tell if can make them all fit legibly.

More Answers (0)

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!