Re: A Question About Directive
- To: mathgroup at smc.vnet.net
- Subject: [mg111140] Re: A Question About Directive
- From: "Kevin J. McCann" <Kevin.McCann at umbc.edu>
- Date: Thu, 22 Jul 2010 05:39:34 -0400 (EDT)
- References: <i23k7a$f1f$1@smc.vnet.net>
Thanks Murray. I understand, but that seems like very little improvement at the cost of a new function. Surely, there must be more. BTW, I think I like the old way better - fewer keystrokes, and I am old fashioned ;) Kevin Murray Eisenberg wrote: > In some situations, using Directive[opt1,opt2] instead of {opt1,opt2} > can make code easier to read by avoiding nested parentheses. > > Compare, for example: > > Plot[{Sin[x],Cos[x]},{x,0,Pi},PlotStyle-> > {Directive[Thick,Red],Directive[Thick,Dashed,Blue]}] > > Plot[{Sin[x], Cos[x]}, {x, 0, Pi}, > PlotStyle -> {{Thick, Red}, {Thick, Dashed, Blue}}] > > On 7/19/2010 2:10 AM, Kevin J. McCann wrote: >> I have noticed the use of Directive in some of the graphics examples >> from Bob Hanlon, David Park, and others. I am curious about this >> command, since it does not appear to do much that is new. For example, >> here is an example from the Help on Directive: >> >> Graphics[{Directive[Red, Thick], Circle[], >> Directive[Blue, Opacity[0.5]], Rectangle[{0, -1}, {2, 1}]}] >> >> However, if I change to this, I get the same thing: >> >> Graphics[{Red, Thick, Circle[], Blue, Opacity[0.5], >> Rectangle[{0, -1}, {2, 1}]}] >> >> So, what is the benefit of Directive? >> >> Thanks, >> >> Kevin >> >