Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Writing a graphic to a notebook

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104716] Re: Writing a graphic to a notebook
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Sat, 7 Nov 2009 06:51:33 -0500 (EST)
  • References: <hd0t88$820$1@smc.vnet.net>

Gerry Flanagan wrote:
> How do you send a graphic to a notebook under program control? For 
> example, taking the documentation example
> CellPrint[Cell[BoxData[ToBoxes[Plot[Sin[x], {x, -2, 2}]]], "Output"]]
> and changing to
> NotebookWrite[nb, Cell[BoxData[ToBoxes[Plot[Sin[x], {x, -2, 2}]]], 
> "Output"]]
> gives an error message (nb is a previously created notebook object).
> 
> I think I've seen this somewhere, and remember it was pretty obscure. 
> Surprising that anything to works inside CellPrint would not work inside 
> NotebookWrite.
> Gerry F.
> 

By 'under program control' I assume you mean creating some graphics part 
way through your calculation. The answer is to use Print:

Print[Plot[Sin[x], {x, -2, 2}]]

Not too obscure, I think you will agree, however one problem with the 
documentation, is that you often can't tell if you are reading about a 
function that is meant for basic use, or one that is meant for 
relatively advanced users (CellPrint and NotebookWrite could reasonably 
be described in the latter category).

David Bailey
http://www.dbaileyconsultancy.co.uk




  • Prev by Date: Re: easy way to represent polynomials (v 7.0)
  • Next by Date: Re: Monitoring using Mathematica
  • Previous by thread: Re: Writing a graphic to a notebook
  • Next by thread: SphericalPlot3D ColorFunction problem