Boxplot - Arrangement of box labels
7 次查看(过去 30 天)
显示 更早的评论
I use the code below to right align the "X tick labels" of my boxplot and adjust the distance to the x axis. This works fine when the figure is created. However, after reopening (or exporting to another format) the distance to the x axis is changed to default (far away from the axis) while the right alignment is kept.
Does anyone know how to fix this issue?
boxplot(all_values, all_names, 'labelorientation', 'inline');
text_h = findobj(gca, 'Type', 'text');
for cnt = 1:length(text_h)
set(text_h(cnt),'HorizontalAlignment', 'right');
yshift=get(text_h(cnt), 'Position');
yshift(2)=-5;
set(text_h(cnt), 'Position', yshift);
end
saveas(gcf,'path/boxplot.fig');
3 个评论
Oleg Komarov
2012-6-8
Actually I could not notice with a +5 but I do have the same problem and see my answer too.
采纳的回答
Oleg Komarov
2012-6-8
Problem NOT solved, but documented. It's a BUG: http://www.mathworks.co.uk/support/bugreports/details.html?rp=228710
2 个评论
Oleg Komarov
2012-6-8
I have not tried but you could try to paste text objects in the position of the labels and check if this keeps on happening.
Good weekend
更多回答(2 个)
the cyclist
2012-6-8
I have two suggestions.
The first is to just try using print() function rather than saveas(), and to play around with different output formats within the command. I suspect that that is not going to solve your issue, as the primitive elements inside the guts of MATLAB are probably going to be the same. (Just guessing here.)
The second suggestion is to try the very nice FEX entry "export_fig":
It is generally much better at "what you see is what you get" between the screen image and the resulting file.
3 个评论
the cyclist
2012-6-8
Hm. Are you able to include a highly distilled example of your code that illustrates the problem?
Kirsten
2014-7-18
anyone know how to fix this in the boxplot m-file? I make boxplots all the time and dealing with moving the labels so they aren't RIGHT ON TOP of the axis is making me crazy!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!