Statalist


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

Re: AW: st: RE: Help with superscript in graphs


From   Nick Winter <nwinter@virginia.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: AW: st: RE: Help with superscript in graphs
Date   Thu, 10 Dec 2009 12:42:01 -0500

Not to beat a dead horse, but it looks to me like there is an actual bug somewhere in the text formatting routines. Note the placement of the subscript:

gr twoway function y=0 , ///
  text(.75 .5 "Default{superscript:superscript}Default") ///
  text(.25 .5 "Default{subscript:subscript}Default")

alignment(bottom) and alignment(baseline) both fix the subscript's placement (sort of), but that seems like it shouldn't be necessary to get subscripts close to the baseline of the regular text ...

This problem does not crop up for [(xy)]titles, just for text().


-Nick Winter


Nick Winter wrote:
Yes, I looked at -help alignmentstyle-.

This example, which places a "default" and "bottom" aligned boxes right up against each other, demonstrates that changing the alignment moves the text slightly (as -help alignmentstyle- suggests), and also moves the superscript relative to the text (which it doesn't).

gr twoway function y=0 , ///
  text(.75 .5 "Default{superscript:vs}(Bottomy)", ///
    box placement(west))     ///
  text(.75 .5  "(Default){superscript:vs}Bottomy", ///
    box alignment(bottom) placement(east))     ///
  text(.25 .5 "Top{superscript:vs}(Baseliney)", ///
    box placement(west) alignment(top) )     ///
  text(.25 .5  "(Top){superscript:vs}Baseliney", ///
    box alignment(baseline) placement(east))

So the movement of the superscript relative to the non-superscripted text still doesn't make sense to me.

-Nick


Martin Weiss wrote:
<>
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/


--
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  nwinter@virginia.edu e
University of Virginia          faculty.virginia.edu/nwinter w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index