MathGroup Archive 2009

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

Search the Archive

Re: Graphics and DisplayFunction

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98203] Re: Graphics and DisplayFunction
  • From: replicatorzed at gmail.com
  • Date: Thu, 2 Apr 2009 04:48:31 -0500 (EST)
  • References: <gqsn9m$3tr$1@smc.vnet.net>

Thanks for the answer Szabolcs,

Ok, so if I understand it correctly then by using explicit
DisplayFunctions, I display the *thing*, that is the side effect of
the actual function. Obviously only things that are enclosed in Show
can be thus displayed with DisplayFunctions, and - however it's just a
guess - the various plot functions all utilize an internal Show which
encloses their internal graphics. Thus - secondarily - DisplayFunction
can be used with plotting functions as well. But then I simply don't
understand why DisplayFunction is an option for Graphics? Neither

Graphics[Circle[], DisplayFunction -> Identity]

nor

Graphics[Circle[], DisplayFunction -> Print];

work as I would expect. I understand, that

ListPlot[{1, 2, 3}, DisplayFunction -> Identity]

is displayed because of the sideeffect, that is NOT suppressed by a
semicolon, while

ListPlot[{1, 2, 3}, DisplayFunction -> Print];

displays the plot because of DisplayFunction Prints the sideeffect,
that is otherwise suppressed by the semicolon.

Still I don't understand why DisplayFunction does not work on Graphics
as would be - for me - logical. Is this side-effect thing a frozen
suboptimal situation of the pre6 era (which I'm quite familiar with,
however I've never realized this difference, probably because I've
managed to live without ever need to use Graphics directly), which WRI
does not want to change?

Istvan


Szabolcs Horv=E1t wrote:
>
> As you said, both produce Graphics expressions. (More precisely, Graphics=
 *is* a Graphics expression.) But there's a difference:  while Graphics[] i=
s just a way to *represent* graphics, plotting functions also have a side e=
ffect of *displaying* the graphics expressions that they produce.
>
> In Mathematica <= 5.2 it worked like this: Graphics expressions were fo=
rmatted in the front end as --Graphics--, and they could be rendered with S=
how[] (which called a function specified in DisplayFunction)
>
> In Mathematica >= 6, Graphics expressions are formatted as the actual p=
icture they represent (in StandardForm/TranditionalForm).  Apart from this,=
 everything works the same as in 5.2.  Of course since the graphics are for=
matted nicely in the front end, there's no need for displaying them in an e=
xplicit way, so $DisplayFunction === Identity by default.
>
> But suppose now that you can't/don't use the front end for some reason, o=
r use an alternative front end.  Now it does make sense to use an explicit =
command for showing the graphics.  Try opening the command line version, an=
d type <<Terminal` or <<JavaGraphics`.
>
> The reason for the semicolon not being highlighted after Graphics[]; is t=
hat in 5.2 no one typed Graphics[...] expecting to get a plot, but using Pl=
ot[...]; was quite common (to suppress displaying the return value, --Graph=
ics--)
>


  • Prev by Date: Re: simpler way to get a particular banded matrix?
  • Next by Date: Re: Update to Hinton Button/palette tutorial for Mathematica 7?
  • Previous by thread: Re: Graphics and DisplayFunction
  • Next by thread: Re: Graphics and DisplayFunction