Reputation: 5569
I have the following picture
figure
y = [2 2 3 2 5 6 2 8 9];
h=bar(y)
name_x = {'0','1','2','4','5','6','8','9','10'}
set(gca,'Xtick',1:9,'XTickLabel',name_x,'XTickLabelRotation',45)
I would like to increase the space between the first group of bars named 0 1 2 and the second group of bars named 4 5 6. Next also between the second and the third named 8 9 10.
I can't recreate the figure... Is it possible to modify it after that it has been created (I have the handle)?
Upvotes: 0
Views: 2322
Reputation: 45752
figure
y = [2 2 3 NaN 2 5 6 NaN 2 8 9];
bar(y)
name_x = {'0','1','2','','4','5','6','','8','9','10'}
set(gca,'Xtick',1:11,'XTickLabel',name_x,'XTickLabelRotation',45)
Incidentally, 'XTickLabelRotation',45
throws an error for me on Matlab 2015a
Also if you want to eliminate the tick marks in the gap then instead of 1:11
you should use [1 2 3 5 6 7 9 10 11]
.
Upvotes: 2