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

Re: st: Text on graphs with categorical axis

From   Scott Merryman <>
Subject   Re: st: Text on graphs with categorical axis
Date   Fri, 26 Jun 2009 12:31:41 -0500

FWIW -graph box- does have a -marker()- option that allows you to
label all the outside values for a given marker:

graph box mpg, over(fore) marker(1, mlabel(make))

Or you could edit the graph using the editor or by the command line

 graph box mpg, over(fore)

 gr_edit plotregion1.outsides[1].label = `"Plym Champ"'


On Fri, Jun 26, 2009 at 11:01 AM, Allan Reese
(Cefas)<> wrote:
> 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

*   For searches and help try:

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