Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: misaligned labels when spanning multiple lines


From   vwiggins@stata.com (Vince Wiggins, StataCorp)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: misaligned labels when spanning multiple lines
Date   Fri, 02 Nov 2007 09:28:52 -0500

Maarten buis <maartenbuis@yahoo.co.uk> reports,

> I came across some curious behaviour when I wanted to let some
> labels on the y-axis span two lines using the -lean1- scheme: Those
> labels that spanned a single line and where specified after the
> "double line label" where alligned above the tick mark, instead of
> centering on the tick mark. This was solved by specifying all double
> line labels at the end. This is probably clearer when looking at the
> results from the example below.

> *--------------- begin example ---------
> sysuse auto
> twoway scatter rep78 mpg,      ///
>      name(misaligned, replace) /// 
>      ylab(1 `""very" "bad""'   ///
>           2 "bad"              ///
>           3 "ok"               ///
>           4 "good"             ///
>           5 `""very" "good""') 
>
> twoway scatter rep78 mpg,      ///
>      name(aligned, replace)    /// 
>      ylab(2 "bad"              ///
>           3 "ok"               ///
>           4 "good"             ///
>           1 `""very" "bad""'   ///
>           5 `""very" "good""') 
> *---------- end example --------------

This inconsistent behaviour shows up in the lean1 scheme because that scheme
uses horizontal y-axis labels.  After a bit of exploring, we have found that
it will happen any time the y-axis labels are horizontal, whether that is
designated by the scheme or by the -angle()- suboption of the -ylabel()-
option.  

Note that the problem occurs only when some labels are multi-line while others
are not and when the y-axis labels are specified to be horizontal.  It will
also occur when mixing multi- and single-line labels on an x-axis if the labels
are vertical, though you are much less likely to want vertical labels on an
x-axis.

We will make this consistent so that the labels are always aligned with the
ticks in a future update.  Until then, Maarten has provided an easy
workaround.


-- Vince 
   vwiggins@stata.com

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index