Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Label categorical axis of - graph box - with dates


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Label categorical axis of - graph box - with dates
Date   Tue, 6 Nov 2012 18:43:07 +0000

I'd want -format()- to work in that context. It's not listed as one of
the cat_axis_label_options, but I share Allan's surprise.

On Tue, Nov 6, 2012 at 5:44 PM, Allan Reese (Cefas)
<allan.reese@cefas.co.uk> wrote:
> This ought to be obvious; apologies if it's well documented elsewhere.
>
> A dataset where the group variable is a date, stored as integer with %td format:
> - tab idate -         shows the dates as 1apr2012 etc with count for each date
> - scatter y idate -   labels the X axis with date values, though not necessarily those in the data
> - graph box y, over(idate) -
>                       labels the categories with the internal (SIF) values
> - graph box y, over(idate, label( angle(30) format(%td) ) ) -
>                       rotates the labels; format is ignored but NOT flagged as error
>
> The workround is to create a string variable containing the date strings, use that for the labels but coerce the date ordering:
>
> - g sdate=string(idate,"%td")  -
> - graph box y, over( sdate, label(angle(30)) sort(idate)) -
>
> It seems a bug that the format is honoured by scatter but not by box, and another that a format option is accepted but ignored.
>
> Allan
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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