MathGroup Archive 2009

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

Search the Archive

Re: Re: display of graphics primitives

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101220] Re: [mg101207] Re: display of graphics primitives
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Sat, 27 Jun 2009 06:02:44 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <h1sv5e$mbi$1@smc.vnet.net> <h1vltl$a1m$1@smc.vnet.net> <200906261054.GAA18455@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

Let me try another, less metaphorical, approach.  In Mathematica, 
"everything is an expression", and an expression always has a head. In 
order to display as a (2D) graphic, an expression must have the head 
Graphics.  For example:

   Head[ Plot[x^2,{x,0,1}] ]
Graphics

On the one hand,

   Head[ Graphics[Circle[]] ]
Graphics

...so that the result of Graphics[Circle[]] is a displayed circle.
On the other hand,

   Head[ Circle[] ]
Circle

... so that the result of Circle[] is NOT a displayed graphic image.
The head of such an object is Circle, and a Circle is one of the 
built-in primitive "graphic-like" (let me call them) objects.

So your original question should perhaps be not, essentially, "Why must 
you wrap Circle[] with Graphics?", but rather "Why do you NOT need to 
wrap a Plot expression with Graphics?".  (By the way, there's nothing 
wrong with Graphics[Plot[x^2,{x,0,1}], it's just redundant.)

Well, another such primitive "graphic-like" object is Line.  And if you 
evaluate, say,

   FullForm[Plot[x^2, {x, 0, 1}]]

then you'll get as result a rather complicated expression, having Head 
Graphics, that includes among other things a whole bunch of Line 
expressions.

So if a "graphic-like" object such as Line or Circle immediately 
displayed graphically, in other words, had head Graphics, then how would 
you expect to combine such things into a more complicated object such as 
the result of Plot?

My point is that this distinction seems a necessary part of the 
underlying design of the Mathematica language.

At least this is my own understanding of the issue. Perhaps an insider 
can correct my understanding.

(But my point does NOT negate the fact that this distinction can then 
force the user to resort to annoying circumlocutions, such as to have to 
add directives inside a plot to specify color, etc., or to include a 
Prolog or Epilog.  David Park's marvelous Presentations package allows 
you to avoid many such circumlocutions and to treat primitive 
"graphic-like" objects and try Graphics objects as if they were all of 
the same kind.)


dsmithy wrote:
> On Jun 25, 7:09 am, "Sjoerd C. de Vries" <sjoerd.c.devr... at gmail.com>
> wrote:
>> Why should the grass be green, why do I have to press 'send' when
>> sending mail and why can't I leave my microwave oven door open while
>> it's doing its job? And why, just why don't I ever win the lottery?
> 
> LOL! But I think you forgot the classic, "Why is the sky blue?"
> Anyway, thanks for the laugh. I guess I'm just trying to understand
> the thinking (principles) behind Mathematica's language design.
>> Count your blessings. Before V6, you had to enclose Graphics with Show
>> to actually generate visible graphics.
> 
> Show... now there's another command I don't really understand the
> point of! For another day, perhaps.
>> Cheers -- Sjoerd
> 
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: laptop recommendation to run mathematica fast?
  • Next by Date: Re: Undocumented functions for working with graphics
  • Previous by thread: Re: display of graphics primitives
  • Next by thread: Re: display of graphics primitives