AW: st: RE: Help with superscript in graphs

 From "Martin Weiss" To Subject AW: st: RE: Help with superscript in graphs Date Thu, 10 Dec 2009 17:51:09 +0100

<>

Only StataCorp can answer the question posed by Nick Winter conclusively, but as -help alignmentstyle- explains the alignments with a reference to a capital "H", the following picture makes sense:

*************
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 "Hr{superscript:2} =  `r2'", box) /*
*/ name(mygr3, replace) nodraw note("default alignment")

graph twoway (scatter mpg price) (lfit mpg price) /*
*/ , legend(off)  /*
*/ text(35  13000 "Hr{superscript:2} =  `r2'", box  /*
*/ alignment(bottom)) /*
*/ name(mygr4, replace) nodraw note("bottom alignment")

graph twoway (scatter mpg price) (lfit mpg price) /*
*/ , legend(off)  /*
*/ text(35  13000 "Hr{superscript:2} =  `r2'", box  /*
*/ alignment(top)) /*
*/ name(mygr5, replace) nodraw note("top alignment")

graph twoway (scatter mpg price) (lfit mpg price) /*
*/ , legend(off)  /*
*/ text(35  13000 "Hr{superscript:2} =  `r2'", box  /*
*/ alignment(baseline) ) /*
*/ name(mygr6, replace) nodraw note("baseline alignment")

graph combine mygr3 mygr4 mygr5 mygr6, rows(2)
*************

The "r" character is probably special in that it does not have a "lower part".

HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox
Gesendet: Donnerstag, 10. Dezember 2009 17:44
An: statalist@hsphsun2.harvard.edu
Betreff: RE: st: RE: Help with superscript in graphs

Good question. You expect me to know all the answers?

Nick
n.j.cox@durham.ac.uk

Nick Winter

*why* does that work?  That is, why is the superscripted text moved down
more than the non-superscripted?

Nick Cox wrote:

> Try this. In passing, I show a more direct way to control format.
>
> 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))
>
> Ricardo Ovaldia, MS
>
> 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} =  0`r2'")

*
*   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/

*
*   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/