Path: news.mathworks.com!not-for-mail
From: "Pekka Kumpulainen" <pekka.nospam.kumpulainen@tut.please.fi>
Newsgroups: comp.soft-sys.matlab
Subject: Re: boxplot
Date: Tue, 18 Nov 2008 18:34:02 +0000 (UTC)
Organization: Tampere University of Technology
Lines: 50
Message-ID: <gfv1qq$si6$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> <gfutjq$6q7$1@fred.mathworks.com>
Reply-To: "Pekka Kumpulainen" <pekka.nospam.kumpulainen@tut.please.fi>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1227033242 29254 172.30.248.37 (18 Nov 2008 18:34:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 18 Nov 2008 18:34:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 218565
Xref: news.mathworks.com comp.soft-sys.matlab:501531


"Lars Barring" <lars.barring@myworkplace.se> wrote in message <gfutjq$6q7$1@fred.mathworks.com>...
> "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

Why not simply modify the existing text objects? You have the handles in hL, 
set(hL,'Rotation',30,'Interpreter','latex')

Ticklabels are special creatures and you are definitely not the only one wishing they would some day support the full set of text object properties, or even close...