Rebecca
Rebecca

Reputation: 351

The axis-x labels show the half with XTickLabel

I am using XTicklabel to change the numbers to labe. I've got 18 numbers, and 18 coresponding labels. But, it takes only half of the labels (just up to half). The codes are:

ab=[230, 231,233, 238, 239, 241, 253, 257, 269, 270, 272, 276, 277, 279, 297, 300, 311,315];
rr=[];
for i=1:length(ab)
rr=[rr,length(find(N(ab(i), :)>0.5))/72];
end
x=1:length(ab);
plot(x, rr)
set(gca,'XLim',[1 length(ab)])
set(gca, 'XTickLabel',{'oo' ,'ho', 'go', 'oh','hh' ,'gh' ,'fg', 'gg' ,'oe', 'he','ge', 'of' ,'hf', 'gf' ,'fc', 'gc' ,'fr', 'gr'})

N is a matrix of 322 X 72.

Any idea please?

Upvotes: 0

Views: 166

Answers (1)

Jens Boldsen
Jens Boldsen

Reputation: 1275

It's not enough to set the XTickLabels, you need to change to XTick-value also!

Try: set(gca,'XTick',1:18);.

Upvotes: 2

Related Questions