MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Plots from Previous Session


  • To: mathgroup@smc.vnet.net
  • Subject: [mg11790] Re: Plots from Previous Session
  • From: Paul Abbott <paul@physics.uwa.edu.au>
  • Date: Sat, 28 Mar 1998 00:25:25 -0500
  • Organization: University of Western Australia
  • References: <6fd520$6a6@smc.vnet.net>

Eric Mockensturm wrote:

> What I would like to do is use plots from previous sessions.  With
> expressions, you can use cmd-L (on a Mac) to copy the previous output
> cell as an input cell.  Can you do something similar with Graphics?
>
> As an example, say you have your computer running overnight to get some
> data and then plot it.  You save and quit.  Then you realize that you'd
> like to overlay some of information on this plot.  Can you make the
> Graphic an input cell and then work with it instead of recalculating
> the data used to make the plot?

Yes.  Make a copy of the Graphic.  Do 

	Cell | Convert to | InputForm

and re-enter the result.  (There is a bug on the Macintosh (at least)
that puts spurious \015 strings into the result -- but it still works).

Here is a related idea which should appear in the next issue of the
Mathematica Journal:

Exporting Graphics

Q: I want to save a Mathematica graphic to a file as a GIF image. Can I
export the graphic from a notebook without re-executing the code that
created it? 

John Fultz (jfultz@wolfram.com) answers: Display can accept a cell
expression as well as a graphics expression. Here is a function that
pulls the cell expression from the notebook and sends it to Display,
thus avoiding recomputing the graphic in the kernel:

	DisplayNotebookGraphic[f_String, n_Integer, t_String] := 
	  Display[f, Cases[NotebookGet[EvaluationNotebook[]], 
	     Cell[GraphicsData[___], ___], -1][[n]], t]

This function must be run in the notebook that contains the graphic. The
first argument is the name of the file to which Display should send its
output. The second argument specifies which graphic to save (the n-th
graphic in the notebook, counting from top to bottom). The third
argument is the file type (such as GIF, EPS, or PDF). For example, this
input saves the first graphic in the notebook to the file test.gif as a
GIF image: 

	DisplayNotebookGraphic["test.gif", 1, "GIF"]; 

Cheers,
	Paul


____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907       
mailto:paul@physics.uwa.edu.au  AUSTRALIA                            
http://www.pd.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________



  • Prev by Date: Re: FindRoot & Grobner basis
  • Next by Date: Re: Vectors and Mathematica
  • Prev by thread: Re: Plots from Previous Session
  • Next by thread: Re: Re: Plots from Previous Session