Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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: [mg70269] RE: [mg70252] On order of options to Graphics[]
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 11 Oct 2006 01:53:12 -0400 (EDT)

Nasser,

There is a difference between a Directive and an Option. A Directive must
come before any Primitives (such as Line or Point) that you want it to
affect. Options all come at the end.

Also, Directives work on a hierarchy. You can group Primitives and
Directives in brackets, {}, and Directives outside the brackets will affect
the Primitives inside the brackets unless you have other Directives inside
the brackets that override.

The order of Options also matters a little. If you repeat an Option, say
with different specifications, it is the first one that will take effect. If
you are feeding options as parameters into a plotting routine, of your own
design say, that has some built-in Options then you want to insert the new
Options before the built-in Options so that you can override them.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

From: Nasser Abbasi [mailto:nma at 12000.org]
To: mathgroup at smc.vnet.net

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




  • Prev by Date: Is it possible to "pre-evaluate" parts of pure function?
  • Next by Date: Re: On order of options to Graphics[]
  • Previous by thread: Re: On order of options to Graphics[]
  • Next by thread: Re: On order of options to Graphics[]