Matlab: Missing labels in bar chart

Viewed 2082

With Matlab 2012 and 2013, I found that setting XTickLabel on a bar chart only works with up to 15 bars. If there are more bars, labels are missing, as shown below.

Plotting 15 bars:

N = 15;
x = 1:N;
labels = num2str(x', '%d');
bar(x);
set(gca, 'XTickLabel', labels);

N = 15

Plotting 16 bars:

N = 16;
x = 1:N;
labels = num2str(x', '%d');
bar(x);
set(gca, 'XTickLabel', labels);

N = 16

For N > 15, it will always only display 10 labels.

Does anyone else experience this? Any work-arounds? I need all labels because I am plotting discrete categories and not a continuous function.

1 Answers
Related