MathGroup Archive 2004

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

Search the Archive

RE: How to make the Mathematica Kernel return DisplayPackets?

  • To: mathgroup at
  • Subject: [mg46008] RE: [mg45965] How to make the Mathematica Kernel return DisplayPackets?
  • From: "Ingolf Dahl" <ingolf.dahl at>
  • Date: Mon, 2 Feb 2004 05:21:01 -0500 (EST)
  • Sender: owner-wri-mathgroup at

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
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"]
  EnterTextPacket["DisplayString[Show[ListPlot[Table[Prime[n], {n,20}]]]]"]]

Then I obtained the PostScript code.

I hope that I have understood your question correctly.

Ingolf Dahl

>-----Original Message-----
>From: Sascha Kratky [mailto:notvalid at]
To: mathgroup at
>Sent: Saturday, January 31, 2004 11:20
>To: mathgroup at
>Subject: [mg46008] [mg45965] How to make the Mathematica Kernel return
>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?
>Sascha Kratky

  • Prev by Date: Re: Defining a function in module problem?
  • Next by Date: Re: RealDigits bug?
  • Previous by thread: Re: How to make the Mathematica Kernel return DisplayPackets?
  • Next by thread: Baffled By Underscore Pattern Matching