Ricardo Ovaldia <[email protected]> asked a question about the
positioning of a superscript in graph text:
> I want to include the r-square value in a graph inside the plot area:
>
> When I specify the option:
>
> text(25 12 "r{superscript:2} = 0`r2'"
>
> I get the desired result except that the superscript is too far above the “r”. How do I get the superscript to be closer to the “r”
>
> Here is an example using the auto data.
>
> sysuse auto, clear
> regress mpg price
> local r2= round(e(r2),.0001)
> graph twoway (scatter mpg price) (lfit mpg price) , legend(off) text(35 13000 "r{superscript:2} = `r2'")
Nick Cox ([email protected]) showed how the behavior changes as the
vertical alignment of the text changes:
> sysuse auto, clear
> regress mpg price
> local r2 : di %04.3f e(r2)
> graph twoway (scatter mpg price) (lfit mpg price) , legend(off) text(35 13000 "r{superscript:2} = `r2'", alignment(bottom))
The behavior Ricardo reported is a bug. Text with the vertical
-alignment()- set to "top" or "middle" will have superscripts and subscripts
appear slightly too high or too low. Text with the vertical -alignment()-
set to "baseline" or "bottom" will have superscripts and subscripts in
the correct position.
This will be fixed in a future update. In the meantime, use
-alignment(bottom)- as Nick showed or -alignment(baseline)- as
a workaround.
Alan
([email protected])
*
* 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/