Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: added graph feature: solution??


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: RE: added graph feature: solution??
Date   Thu, 5 Aug 2004 07:52:21 -0400

I found that -graph describe- also provide a lot of info about a saved graph
through  -return list-.  I wrote up a short ado a while ago that grabs the
graph command from a saved graph file and puts it in the review window so
that I can click on it and edit it in future sessions.  I still need to use
the right dta file to make any edits work, but that's not too hard (and
typing -ret li- will tell me what file I was using).

program define grget
version 8.2
args gname
qui graph describe `gname'
window push `r(command)'
end


then I just type:

grget mygraph.gph

This approach won't solve the problem with higher level graph commands that
use tempvars, like Kaplan-Meier graphs, because those variables no longer
exist once the graph is rendered -- although their values are stored in
sersets in the gph file.

Michael Blasnik
[email protected]


----- Original Message ----- 
From: "Nick Cox" <[email protected]>
To: <[email protected]>
Sent: Wednesday, August 04, 2004 6:07 AM
Subject: RE: st: RE: added graph feature: solution??


> This is the issue that Fred Wolfe and I batted back
> and forth, although some of the discussion was
> guessing in the dark before -gs_fileinfo- was remembered.
>
> The key point as I understand it is that the command Stata's graph
> internals received, which was not what you typed, is to be
> interpreted with reference to the serset associated with the graph.
>
> Nick
> [email protected]
>
> Ron�n Conroy
> >
> > on 03/08/2004 18:30, Nick Cox at [email protected] wrote:
> >
> > > A few days ago, I pointed someone to
> > > the -undocumented- options in this area.
> > > Following that lead,
> > >
> > > . gs_fileinfo <whatever>.gph
> > >
> > > returns this information in r(command)
> > > etc.
> >
> > We're almost there. I tried this, and got the following
> >
> > . gs_fileinfo  "/Users/ronanconroy/Documents/Consult files/Richard
> > Costello/FVC50.gph"
> >
> > . di r(command)
> > twoway  (line  __00000H __00000I _t, sort connect(J ...)
> > ylabel(0(.25)1,
> > grid) ytitle(`""')  x
> > > title(`"analysis time"') pstyle( p1 p2)
> > title(`"Kaplan-Meier survival
> > estimates, by FVC"' `"
> > > "') legend(order(1 2))   yscale( ) ytitle(Proportion surv
> >
> >
> >
> > There is an obvious problem: the graph (A Kaplan-Meier) is
> > described in
> > terms of the variables that Stata calculated, and the
> > underlying command
> > (-twoway-) not the original command syntax that I used (-sts graph-).
> >
> >
> > However, the other information returned is very useful
> > indeed. So much so
> > that I am surprised that Stata doesn't have a menu item
> > saying 'get graph
> > info' rather than an undocumented command!
> >
> > With a little modification, however, it is clear that Stata
> > could capture,
> > verbatim, the command used to generate a graph. What it
> > captures right now
> > is maddeningly close...


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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