How determine the scale of x label ?

Hey, i'm trying to plot this data where the x label is the time, but i dont want this separation in the axis x, the current data already is in the format "..1958,1959,2000,2001.." anyone know how to solve this scale issues ?

 Accepted Answer

Instead of bar(x, y), use
ax = gca;
t = 1:length(y);
bar(t, y, 'Parent', ax);
set(ax, 'XTick', t, 'XTickLabel', x);

2 Comments

Thats work ! Thanks for the help,
Do you have a adivice for better this plot ? I mean, put the "1950,1951.." written vertically in the axis x ?
That mini bars on the top of the figure, i can remove that ?
You can set axes XTickLabelRotation to 90.
The bars at the top are tick locations. I do not see a way to turn them off, but you could set the axes TickLength to something that barely shows up.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!