RE: How to make the Mathematica Kernel return DisplayPackets?
- To: mathgroup at smc.vnet.net
- Subject: [mg46008] RE: [mg45965] How to make the Mathematica Kernel return DisplayPackets?
- From: "Ingolf Dahl" <ingolf.dahl at telia.com>
- Date: Mon, 2 Feb 2004 05:21:01 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Two methods to obtain the PostScript code, if you want that explicitly: 1) Select the cell, where the graphics is rendered, and choose "Show expression" under the "Format" menu (or Shift+Ctrl+E under Windows)). 2) Take a = DisplayString[Show[ListPlot[Table[Prime[n], {n, 20}]]]] Then a will contain the whole PostScript code in one single string, which you may use in further operations, if you for instance want to modify it yourself. You then can get your figure back by CellPrint[Cell[GraphicsData["PostScript", a], "Graphics"]] This you maybe know already. You wanted to obtain PostScript by the use of MathLink commands. I succeeded by doing the following: link = LinkLaunch["math -mathlink"] LinkRead[link] LinkWrite[link, EnterTextPacket["DisplayString[Show[ListPlot[Table[Prime[n], {n,20}]]]]"]] LinkRead[link] LinkRead[link] Then I obtained the PostScript code. I hope that I have understood your question correctly. Ingolf Dahl Sweden >-----Original Message----- >From: Sascha Kratky [mailto:notvalid at notvalid.com] To: mathgroup at smc.vnet.net >Sent: Saturday, January 31, 2004 11:20 >To: mathgroup at smc.vnet.net >Subject: [mg46008] [mg45965] How to make the Mathematica Kernel return >DisplayPackets? > > > >Hi, > >I am trying to use the Mathematica Kernel to render graphics into >Postscript. E.g., using Mathink I am sending the following expression >to the kernel wrapped in an EvaluatePacket: > >Show[ListPlot[Table[Prime[n], {n, 20}]]] > >The Kernel however does not send back DisplayPackets but returns a >"Graphics" expression with graphic primitives but without any >Postscript data in it. Do I have to use a different packet type to make >the Kernel return the rendered Postscript image? > >Thanks, >Sascha Kratky >