Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: boxplot
Date: Tue, 18 Nov 2008 17:22:02 +0000 (UTC)
Organization: Lunds Universitet
Lines: 44
Message-ID: <gfutjq$6q7$1@fred.mathworks.com>
References: <gfk36r$bca$1@fred.mathworks.com> <gfr9uh$6lr$1@fred.mathworks.com> <gfsaa1$g5q$1@fred.mathworks.com> <gfu5kt$fhe$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1227028922 6983 172.30.248.38 (18 Nov 2008 17:22:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 18 Nov 2008 17:22:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 5707
Xref: news.mathworks.com comp.soft-sys.matlab:501497


"Pekka Kumpulainen" <pekka.nospam.kumpulainen@tut.please.fi> wrote ...
> "Lars Barring" <lars.barring@myworkplace.se> wrote ...
...
> One reason why they use separate text objects instead of XTickLabels (or Y..) 
> might be that tixklabels dont support tex or rotating, which is an option in boxplot.
> But yes, could be more clear. However most things can be specified in the input 
> arguments of boxplot.

I wanted to have the x ticks not rotated 90 degrees but slanting at 40-60 
degrees. Which I normally achieve with the excellent FEX routine ROTATETICKLABEL.
And I wanted my labels to include TeX formatting (Greek letters as subscripts). 
Both to which the BOXPLOT "x-labels" were completely indifferent. Well, I 
digged deep enough to come up with this solution 

hA=subplot(2,2,1);
boxplot(c(L,1:n1))
set(hA,'FontSize',11,'YLim',[ymin 1],'Position',[0.08 0.62 0.39 0.32]);
hB=findobj(hA,'Type','hggroup');
hL=findobj(hB,'Type','text');
delete(hL)
set(gca,'XTick',[1:n1]);
set(gca,'XTickLabel',IXName');
hT=rotateticklabel(gca,-30);
for k=1:n1,
  set(hT(k),'FontSize',11,'Position',[k ymin*dd 0]);
end

The rather "interesting" but counterintuitive result of this tweak is 
that I get a plot that looks as I want, *but* the x-tick labels (i.e the 
hT text objects) are still children under the BOXPLOT hggroup. 
Bug or feature???? 

I am sure that there is a perfectly valid explanation to this behaviour
(along the lines you mention; rotation etc). But what really beats me is 
why this is implemented in this rather unintuitive, inconsistent with other
plot functions, and totally undocumented and difficult to find way [sorry about
all these un- and in- words but I spent some 6 hours on this, including finding 
a useful dd vertical displacement of the text]. 

TMW: why not just do the right thing and make the axis labels available as 
children to the axes object with some nice and useful defaults ??


Lars