Statalist


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

st: Text on graphs with categorical axis


From   "Allan Reese (Cefas)" <[email protected]>
To   <[email protected]>
Subject   st: Text on graphs with categorical axis
Date   Fri, 26 Jun 2009 17:01:22 +0100

It's easy to put text on a graph - text(y x "text") - but the assumption
is that x is in the scale units.  This still works when the x axis is
categorical (as in bar, dot, box, etc) but I can't find the gen on how
to map factor levels to distance along scale.  It seems to be on a
percentage scale, and guesswork leads to- graph box mpg, over(foreign)
text(34 20 "Plym Champ", place(e)). The calculation would be more
complex with extra levels, nested factors, or adjusted gaps.  

Do others see a need for a notation to deliver the x value along a
categorical axis?  It could be used in the text() option or more
generally as an egen function to cover needs such as overlaying other
values or text on boxplots.

text( 34 xcatpos[foreign==0] "Plym Champ" )

Once you admit that the categories have to be mapped to a scale axis for
plotting, it should be feasible to overlay a scatterplot and a boxplot,
which has often seemed sensible to me.  

Happy weekend everyone
Allan

R Allan Reese
Senior statistician, Cefas
The Nothe, Weymouth DT4 8UB 

Tel: +44 (0)1305 206614 -direct
Fax: +44 (0)1305 206601 

www.cefas.co.uk 



***********************************************************************************
This email and any attachments are intended for the named recipient only.  Its unauthorised use, distribution, disclosure, storage or copying is not permitted.  If you have received it in error, please destroy all copies and notify the sender.  In messages of a non-business nature, the views and opinions expressed are the author's own and do not necessarily reflect those of the organisation from which it is sent.  All emails may be subject to monitoring.
***********************************************************************************


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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