Writing a graphic to a notebook

*To*: mathgroup at smc.vnet.net*Subject*: [mg104650] Writing a graphic to a notebook*From*: Gerry Flanagan <flanagan at materials-sciences.com>*Date*: Fri, 6 Nov 2009 05:14:02 -0500 (EST)

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.