Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: Re: st: RE: RE: Plots: save, log, ...


From   "b. water" <barleywater@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: Re: st: RE: RE: Plots: save, log, ...
Date   Tue, 16 May 2006 11:13:02 +0000

MA V,

i am using Stata 8.2,

may be what you need is simpler and was hinted in david elliott solution i.e. you can incorporate:

.graph export "dir\path.wmf" <- graph type can be wmf or others, check help/manual

after each -graph- in your .do file (granted though that this might involve copy and paste -graph export- commands). this will however save you from "copy paste" individual graph from Stata window to whichever folder you want.

hope this help,
bw




----------------------------------------
> Date: Mon, 15 May 2006 21:45:03 -0300
> From: dcelliott@gmail.com
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: RE: RE: Plots: save, log, ...
> 
> Some further thoughts.  First, I want to make it clear that this is a
> real kludge, but it works!
> 
> Imagine this:
> 
>  log using example.html, replace
> -------------------------------------------------------------------------------------------------------------
>       log:  W:\data\example.html
>  log type:  text
>  opened on:  15 May 2006, 20:46:43
> 
> note <pre>
> 
> . [graph command]
> . graph export test.png
> file test.png saved
> . note <img src=test.png>
> . note </pre>
> . log close
>       log:  W:\data\example.html
>  log type:  text
>  closed on:  15 May 2006, 20:49:11
> -------------------------------------------------------------------------------------------------------------
> 
> .  winexec "C:\Program Files\Mozilla\Firefox\firefox.exe"
> file:///W:/data/example.html
> 
> 
> What the above does is it writes some truly bastard html that most
> browsers will be able to render.  Using note, one can insert html
> tags.  The  pre tag tells the browser to treat what follows as
> preformatted text.  This should cause the browser to include all
> spaces, line breaks and such and render in a monospaced font.  The
> graph export result in a portable network graphics file that can be
> shown in a browser with the img tag, again inserted using note.
> Finally the pre tag is closed and the log is closed.
> 
> If you are using windows, the winexec command followed by the path to
> your browser and the html log file URL will bring up the log in your
> browser.
> 
> I don't know if the tags in this example will come through, many
> mailers strip HTML.  I am attaching a zipped version of this message
> just in case.
> 
> DCE
> 
> On 5/15/06, David Elliott <dcelliott@gmail.com> wrote:
> > There is another possibility here if you want graphs to be readily
> > accessible from your log file.
> >
> > Imagine this scenario, saving your log as SMCL:
> >
> >  log using example, replace
> > -------------------------------------------------------------------------------------------------------------
> >        log:  W:\data\example.smcl
> >   log type:  smcl
> >  opened on:  15 May 2006, 20:46:43
> >
> > . [graph command], saving(test)
> >
> > file test.gph saved
> >
> > . di "{stata graph use test:Display test graph}"
> > Display test graph
> >
> > . log close
> >        log:  W:\data\example.smcl
> >   log type:  smcl
> >  closed on:  15 May 2006, 20:49:11
> > -------------------------------------------------------------------------------------------------------------
> >
> > . view  W:\data\example.smcl
> >
> >
> > The viewer will show the log file with a hot link to the graph itself.
> >  When you click on the "Display test graph" text, the graph will be
> > loaded.  This process could be easily automated.  It all depends on
> > how exactly you want to use the output.
> >
> > I look forward to the day when a SMCL to HTML option does all this for us...
> >
> > DCE
> >
> >
> > On 5/15/06, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> > > Sorry, but you have lost me.
> > >
> > > Unless what you want is this:
> > >
> > > one big file that in some way keeps all
> > > the graph files in a session, just as a .log
> > > file can store all the results displayed in a session.
> > >
> > > There is no such thing. (You can use your operating
> > > system or a text editor or a scripting language
> > > to produce such a file by concatenation, but it
> > > won't help, as you will just have to unpack it
> > > all again before Stata can make sense of it.)
> > >
> > > A log file can include anything.
> > >
> > > The same does not apply to a graph file.
> > >
> > > A graph file at root contains Stata code to draw one graph.
> > > That graph can be a composite, but that's it.
> > >
> > > Nick
> > > n.j.cox@durham.ac.uk
> > >
> > > MA V
> > >
> > > > Thanks. But since I really want the graphs individually,
> > > > combine does not
> > > > seem to be an option here.
> > > > Ideally, I would like stata to save all the graphs in the do
> > > > file to one
> > > > single file. Note that I have a huge do file not only with
> > > > graphs but with
> > > > other statistics as well.
> > > > Do I have to "copy paste" every plot?
> > > >
> > > > >From: "Nick Cox" <n.j.cox@durham.ac.uk>
> > >
> > > > >MA V
> > > > >
> > > > > > If I run a do file I can save all my output in a log file.
> > > > > > But this will not
> > > > > > include the graphics... So, is there an easy way of getting
> > > > > > all the plots
> > > > > > into a single file? I would like to avoid having to copy and
> > > > > > paste the plots
> > > > > > one by one...I have many plots in my do file so this last
> > > > > > option can be very time-consuming.
> > > > >
> > > > >You can do this if you want. You just need to
> > > > >issue names for the plots you produce, gather them
> > > > >all together and then use -graph combine-.
> > > > >
> > > > >The principle is illustrated by this:
> > > > >
> > > > >--------------------- may15.do
> > > > >sysuse auto, clear
> > > > >histogram mpg, saving(do1)
> > > > >scatter mpg weight, saving(do2)
> > > > >graph combine "do1" "do2"
> > > > >---------------------
> > > > >
> > > > >In practice, almost always, users either want
> > > > >graphs individually or have far too many graphs
> > > > >to put on one plot. But there is no intrinsic
> > > > >difficulty to what you want, nor a short-cut
> > > > >way to doing it.
> > > > >
> > > > >Nick
> > > > >n.j.cox@durham.ac.uk
> > >
> > > *
> > > *   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/
> > >
> >
> >
> >
> > --
> > David Elliott
> >
> 
> 
> -- 
> David Elliott

_________________________________________________________________
Because e-mail on your cell phone should be easy:  Try Windows Live Mail for Mobile beta
http://www2.imagine-msn.com/minisites/mail/Default.aspx?locale=en-us
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index