Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Centering of graphics

  • To: mathgroup at
  • Subject: [mg57773] Re: [mg57747] Centering of graphics
  • From: "David Park" <djmp at>
  • Date: Wed, 8 Jun 2005 03:21:22 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


I'm glad you asked that because I learned something.

In the Help for DisplayFunction (In Version 5.1.1 at least), under Examples,
there is the routine:

    gr : (_Graphics | _Graphics3D | _SurfaceGraphics | _DensityGraphics | \
_ContourGraphics)] :=
  Module[{psstring, cellexpr},
    SelectionMove[EvaluationNotebook[], After, EvaluationCell];
    psstring = DisplayString[gr];
    cellexpr =
      Cell[TextData[{Cell[GraphicsData["PostScript", psstring]]}],
         TextAlignment -> Center];
    NotebookWrite[EvaluationNotebook[], cellexpr]]

which keeps the graphics always centered in the notebook.

Plot[Sin[x], {x, 0, 2Pi},
  DisplayFunction -> CenteredGraphicDisplayFunction]

David Park
djmp at

From: wossmer [mailto:1107-209 at]
To: mathgroup at

Dear colleagues,

I am just writing a technical text with a lot of imported and Mathematica
generated pictures/graphics. I wonder how to center them automatically. Or
is there no solution for this "simple" problem? The contribution in the
MathGroup Archive 1999 "centering a figure" from P.J. Hinton did not work:
the picture keeps more at the left side  than in the center of the page. I
use Mathematica 5.1.

Any suggestions?

Best regards


  • Prev by Date: Re: Finding Position in an ordered list
  • Next by Date: Reloading packages: Removed[symbol]
  • Previous by thread: Re: Re: Mathematica TeX save in standard LaTeX style
  • Next by thread: Reloading packages: Removed[symbol]