Why does the upper limit on the x-axis of a bar chart round up to the next highest power of ten in MATLAB 7.0.1 (R14SP1) and prior versions?

3 views (last 30 days)
When I create a bar chart using the following commands,
A = rand (64, 1);
bar(A);
I obtain a plot, which has the following x-axis limits:
0 70
The documentation states:
The x-axis scale ranges from 1 to length(Y) when Y is a vector, and 1 to size(Y,1), which is the number of rows, when Y is a matrix.
This suggests the upper limit on the x-axis should be 64.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed in Release 14 Service Pack 2 (R14SP2). For previous releases, please read below for any possible workarounds:
This has been verified as an error in the documentation in MATLAB 7.0.1 (R14SP1) and previous versions.
To obtain the behavior described in the documentation, use the following command:
set(gca,'xlim', [1 length(A)]);

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!