*! 1.0.1 GML 28 Aug 2000
* fh and fw arguments are now % of default font height and width
* taken from Stata manual [G] p.64, with a few syntax additions/modifications
prog define addtxt
    version 6
    gettoken x 0 : 0,
    gettoken y 0 : 0, parse(" ,")
    syntax ,Text(string) [Align(integer -1) Rotate(integer 0)  /*
    */      FHgt(int 100) FWdth(int 100) Pen(int 1) SAving(string) ]
    confirm number `x'
    confirm number `y'
    local fhgt = 570*(`fhgt'/100.)
    local fwdth = 290*(`fwdth'/100.)
    if "`saving'" ~="" { local save `",saving(`saving')"' }
    gph open `save'
    cap graph
    if _rc ~= 0 {
        gph close
        di in red "error opening previous graph"
        exit _rc
    }
    local ay = r(ay)
    local by = r(by)
    local ax = r(ax)
    local bx = r(bx)
    local r = `ay'*`y' + `by'
    local c = `ax'*`x' + `bx'
    gph pen `pen'
    gph font `fhgt' `fwdth'
    /* gph close
     di "r:      " `r'
     di "c:      " `c'
     di "rotate: " `rotate'
     di "align:  " `align'
     di "text:    `text' "
     pause "after gph font "
    */
    gph text `r' `c' `rotate' `align' `text'
    gph close
end