Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

work with graphics and output in a different notebook from the one containing your code

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55557] work with graphics and output in a different notebook from the one containing your code
  • From: Chris Chiasson <chris.chiasson at gmail.com>
  • Date: Tue, 29 Mar 2005 04:20:04 -0500 (EST)
  • Reply-to: Chris Chiasson <chris.chiasson at gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Have you ever wanted to output graphics or maybe all output cells to
another notebook while you're doing your analyses?

You might want to do this if you:

magnify (Format -> Magnification)  your working notebook to avoid eye
strain, but need to know what your plots will look like in other
applications

are annoyed by the "notebook length changes" that happen when
reevaluating a long notebook

Below, you will find code (not a package) to send output and graphics
to another notebook.

Notes:

targetnb is the target notebook object. It is not Saveable by default.

send will send output to targetnb.

blockgraphics will block graphics output

bsgraphics will block and send graphics to targetnb

Examples:

"hello there"//send

Plot[x^2,{x,0,3}]//bsgraphics

I owe thanks to David Park for his code in the MathGroup post located
at the following url:
http://forums.wolfram.com/mathgroup/archive/2001/Jul/msg00150.html

(***************Code*****************)
If[MemberQ[Notebooks[],targetnb],,targetnb=NotebookCreate[Saveable->False]];
send=NotebookWrite[targetnb,Cell[BoxData[ToBoxes[#],"Output"]]]&;
sendgraphics=
    NotebookWrite[targetnb,
        Cell[GraphicsData["PostScript",DisplayString[#]],"Graphics"]]&;
Attributes[blockgraphics]={HoldAll};
blockgraphics[plot_]:=Block[{$DisplayFunction=Identity},plot];
Attributes[bsgraphics]={HoldAll};
bsgraphics[plot_]:=sendgraphics@blockgraphics@plot
(***************End*****************)

Regards,

Tips for improvement are welcome!
-- 
Chris Chiasson
Kettering University
Mechanical Engineering
Graduate Student
1 810 265 3161


  • Prev by Date: Re: Re: Unicode Support
  • Next by Date: Re: Re: point in convex hull
  • Previous by thread: Re: Position function
  • Next by thread: Re: work with graphics and output in a different notebook from the one containing your code