DisplayString

The next line shows the DisplayString usage message.

? DisplayString

DisplayString[graphics] generates a string giving graphics or sound in Mathematica PostScript  ... enerates a string giving boxes, cells or notebook expressions in the specified format. More…

The Postscript expression returned by DisplayString can sometimes be used by other programs.  We can also use the Postsript to make Graphics output that we can't otherwise make without manual adjustment as I demonstrate below.  First the next Input makes (ps) the PostScript used to render a plot.

gr = Plot[Sin[x], {x, 0, π}, DisplayFunctionIdentity, PlotPoints->5, PlotDivision->2] ; ps = DisplayString[gr]

Then the next Input renders the graphics with a non-default setting for CellMargins.

 NotebookWrite[ SelectedNotebook[],           &nbs ... ot;PostScript", ps], "Graphics", CellMargins {{150, 0}, {0, 30}}] ]


Created by Mathematica  (May 16, 2004)

Back to Ted’s Tricks index page