Statalist


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

st: displaying a subscript in a graph


From   Miranda Kim <[email protected]>
To   [email protected]
Subject   st: displaying a subscript in a graph
Date   Wed, 07 Oct 2009 13:17:37 +0100

I am using stata 10, and wanted to include a subscript in the x-axis title of my twoway scatter graph, but the following is not working:
xtitle("Gestational period" "p{subscript:e}=...")
it simply displays "p{subscript:e}=..." rather than actually formatting the "e" as a subscript Does anyone have any ideas why it's not working and if there are alternative methods for doing this?
Many thanks!

the full code for my graph is as follows:
capture program drop medplot
program define medplot
   local k = 0
   local grcomb = ""
   foreach outcome of local 0 {
           qui {
               preserve

               medsplit `outcome'
               local k = `k' + 1
               local varlab :var lab `outcome'
local title = proper(word("`varlab'",2)) + " " + word("`varlab'",3)
               local ytitle `=subinstr("`varlab'", "Baby","",.)'
               local ytitle `=subinstr("`ytitle'", "4-year","",.)'
               local ytitle `=subinstr("`ytitle'", "6-year","",.)'
twoway (scatter mean00 T, msymbol(D) mcolor(gs5) c(l) lcolor(gs5) lp(dash) /// xscale(range(0.7 2.3)) xlab(1 2, valuelabel) xtitle("Gestational period" " " "p{it:e}=" "pL=", size(medlarge) margin(medsmall)) /// ylab(#6) ytitle("Average `ytitle'", size(medlarge) margin(medsmall)) ///
                           title("`title'", size(vlarge) margin(small)) ///
name(gr`k') nodraw legend(order (4 3 2 1) row(1) margin(small))|| /// (scatter mean01 T, msymbol(D) mcolor(gs5) c(l) lcolor(gs5)) || /// (scatter mean10 T, msymbol(D) mcolor(black) c(l) lcolor(black) lp(dash))|| /// (scatter mean11 T, msymbol(D) mcolor(black) c(l) lcolor(black)) local grcomb = "`grcomb' gr`k'"

               restore
           }
   }
   grc1leg `grcomb', c(3) leg(gr2)
   gr drop `grcomb'
end

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