MathGroup Archive 2006

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

Search the Archive

Re: On order of options to Graphics[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70287] Re: [mg70252] On order of options to Graphics[]
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Wed, 11 Oct 2006 01:54:19 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200610101011.GAA27116@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

It seems to me that a bit of reasoning (or experimentation) would 
quickly make one realize that a directive such as Thickness affects the 
graphics primitives that follow it, and NOT those that precede it.

Actually, this IS clearly documented in The Mathematica Book, section 
2.10.1:

   Given a particular list of graphics primitives, Mathematica provides
   two basic mechanisms for modifying the final form of graphics you get.
   First, you can insert into the list of graphics primitives certain
   graphics directives, such as RGBColor, which modify the SUBSEQUENT
   graphical elements in the list. [emphasis added]

And the Help Browser examples DO illustrate this positional effect. 
Look, for example, at the entry for Graphics.  The very first of the 
"Further Examples" quite clearly shows the directives preceding the 
primitives.

With this arrangement, a single Graphics expression allows you to change 
from one Thickness (or color, etc.) to another for different graphics 
elements.

(Another, plausible, alternative -- which Mathematica does not use -- 
would be a requirement for nested lists, with the directives inside each 
lower-level list to apply only to all graphics primitives within that 
lower-level list.)

Nasser Abbasi wrote:
> 5.2 on XP:
> 
> It seems strange to me that the order of arguments in this example should 
> have made a difference, but it does:
> 
> When I write Thickness[] After Line[] it has no effect. But before, it does:
> 
> Show[  Graphics[    {  Line[{{1, 0}, {1, 6}}],   Thickness[0.1] }   ]  ] 
> (*does not work eq(1)*)
> 
> Show[  Graphics[    {  Thickness[0.1],  Line[{{1, 0}, {1, 6}}]  }   ]  ] 
> (*now it works  eq(2)*)
> 
>>From help it says:
> 
>           Graphics[ primitives, options]
> 
> Then It gives Line[] as an example of a graphic primitive, and Thickness[] 
> as an example of graphics Directive. But help did NOT say which order the 
> primitive and directive should have with respect to each others. It just 
> says "the following directives can be used" and leaves it up to the user to 
> figure that the order of primitive and directive is important.
> 
> So based on this little experiment, One must write
> 
>          Graphics[  {  Directive, Primitive } ]  ----> maps to eq (2) which 
> works
> 
> and not
> 
>         Graphics[  { Primitive, Directive } ] ----> maps to eq(1)
> 
> It seems more logical to me to write {Primitive,Directive}. But this does 
> not work. One must have the Directive before the Primitive.
> 
> I wish the help can be more detailed. I find Mathematica help hard to follow 
> many times. Mathematica help needs to be more detailed.
> 
> Nasser
> 
> 
> 

-- 
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: On order of options to Graphics[]
  • Next by Date: Re: Correlating binary variables
  • Previous by thread: Re: On order of options to Graphics[]
  • Next by thread: RE: On order of options to Graphics[]