Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1680

Re: Coloring curves: not as simple as it sounds..

From Chris Rodgers <see-rodgers-org-uk-for-contact-details@invalid.gg>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Coloring curves: not as simple as it sounds..
Date 2011-04-14 11:08 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <io6kjm$ffs$1@smc.vnet.net> (permalink)
References <io6d17$dpl$1@smc.vnet.net>

Show all headers | View raw


Not a full explanation, but try this:

Plot[Evaluate[{a x, a x^2, a x^3} /. {a -> 1}], {x, 0, 2},
  PlotStyle -> {Red, Green, Blue}]

That works for me.

Now run

Attributes[Plot]

So, the issue is to do with the HoldAll attribute on Plot. I guess when 
Plot counts the number of lines it is expecting to produce, it doesn't 
untangle your rule replacement.

C.

On 14/04/2011 09:59, Jean-Michel Di Nicola wrote:
> All,
>
> I have a question that looks fairly trivial, but I cannot solve it....
> Please help!
>
> Thanks, JM
>
> Here is a simplified toy example.
> When I type
> Plot[{a x /. {a ->  1}, a x^2 /. {a ->  1}, a x^3 /. {a ->  1}}, {x, 0,
>    2}, PlotStyle ->  {Red, Green, Blue}]
> I get 3 curves with different colors.
>
> Well, when I type
> Plot[{a x, a x^2, a x^3} /. {a ->  1}, {x, 0, 2},
>   PlotStyle ->  {Red, Green, Blue}]
> I get 3 curves but they are all blue, WHY?
>
> However, when I evaluate {a x /. {a ->  1}, a x^2 /. {a ->  1}, a x^3 /.
> {a ->  1} and {a x, a x^2, a x^3} /. {a ->  1}, they both give the same
> result....{x, x^2, x^3}.
>
> Thank you for your help!!!
>

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Coloring curves: not as simple as it sounds.. Jean-Michel Di Nicola <jeanmichel.dinicola@gmail.com> - 2011-04-14 08:59 +0000
  Re: Coloring curves: not as simple as it sounds.. David Bailey <dave@removedbailey.co.uk> - 2011-04-14 11:08 +0000
    Re: Coloring curves: not as simple as it sounds.. Jean-Michel Di Nicola <jeanmichel.dinicola@gmail.com> - 2011-04-15 07:55 +0000
  Re: Coloring curves: not as simple as it sounds.. Chris Rodgers <see-rodgers-org-uk-for-contact-details@invalid.gg> - 2011-04-14 11:08 +0000
  Re: Coloring curves: not as simple as it sounds.. Peter Pein <petsie@dordos.net> - 2011-04-15 07:55 +0000

csiph-web