MathGroup Archive 2010

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

Search the Archive

Re: A Question About Directive

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111198] Re: A Question About Directive
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Fri, 23 Jul 2010 07:12:34 -0400 (EDT)

Good example! Of course one _could_ still dispense with Directive in the 
first one, using instead...

   Plot[{Cos[x], Sin[x]}, {x, 0, 2 Pi}, PlotStyle -> {{Thick, Red}}]

... with the nested PlotStyle value. And here, too, the point is that 
Directive provides a convenience of eliminating nested braces.

Just because a function such as Directive in such situations is a mere 
convenience and not indispensable does not militate against its 
existence. After all, some other newer functions such as Total or 
Accumulate are also dispensable but nonetheless conveniences.

If you want to stick with fewer functions, just go ahead and use the 
nested parentheses.

On 7/22/2010 5:42 AM, Mark McClure wrote:
> On Mon, Jul 19, 2010 at 2:10 AM, Kevin J. McCann<kjm at kevinmccann.com>  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.
>> ...
>> So, what is the benefit of Directive?
>
> Try
> Plot[{Cos[x], Sin[x]}, {x, 0, 2 Pi},
>   PlotStyle ->  Directive[Thick, Red]]
> vs
> Plot[{Cos[x], Sin[x]}, {x, 0, 2 Pi},
>   PlotStyle ->  List[Thick, Red]]
>
> Mark McClure
>

-- 
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: Usage statements, hyperlinks, and usage button
  • Next by Date: Re: how to create a mathematica package
  • Previous by thread: Re: A Question About Directive
  • Next by thread: Re: A Question About Directive