Boxplot Labels with more than one line
6 views (last 30 days)
Show older comments
I am using the boxplot function to plot a grouped data set. I want the labels to have two lines: A name and the number of points (n).
for example:
%in a loop I set each label:
for i = 1:p
label2{i} = sprintf(label{i} '\n n = %d'], n(i)));
end
boxplot(data,G,'labels',char(label2{:})
The problem is that the label end up halfway above/below the xaxis line. I can use the findobj to get the text labels but not sure how to correct their position. I tried adding newlines in front of the labels but boxplot just ignored them. Any help?
I suppose a work around would be to make my own text labels for each box, but I think having them in the xlabel axis would be nice. I plan on making about 30 boxplot graphs like this so it would be nice to be able to do it programatically.
Liam
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!