MATLAB: Rotate x axis labels boxplot Matlab 2015

graphicsmatlab 2015r2014bgraphics

Hi there, I am trying to rotate labels on my boxplot but the code I am using doesn't seem to work on the 2015 version of Matlab. For example, the code I am using looks like this:
hA = boxplot(data,'Labels',names);
hb = findobj(parentFig,'Type','hggroup');
fontSize = 10;
rotation = 90;
text_h = findobj(hB,'Type','text');
for cnt = 1:length(text_h)
set(text_h(cnt), 'FontSize',fontSize,...
'Rotation',rotation,...
'String',names{length(names)-cnt+1},...
'HorizontalAlignment','right',...
'VerticalAlignment','middle');
end
Is there something I am not doing right?

Best Answer

As of R2014b, it is a lot simpler:
boxplot(data,'Labels',names);
set(gca,'FontSize',10,'XTickLabelRotation',90)
Related Question