Re: Setting Colours of Plots
- To: mathgroup at smc.vnet.net
- Subject: [mg84641] Re: Setting Colours of Plots
- From: ddsc at 4sbwthu.org
- Date: Tue, 8 Jan 2008 01:26:32 -0500 (EST)
- References: <flqbut$j8h$1@smc.vnet.net>
> Different colors :
> Plot[{x, 2 x, 3 x, 4 x, 5 x}, {x, 0, 1}]
> Same colors:
> Plot[Table[n*x, {n, 5}], {x, 0, 1}]
> Plot[{x, 2 x, 3 x, 4 x, 5 x}, {x, 0, 1}, PlotStyle -> Blue]
Different colors:
a = Table[n*x, {n, 5}];
Plot[a, {x, 0, 1}]
Same colors:
Plot[Table[n*x, {n, 5}], {x, 0, 1}]
b := Table[n*x, {n, 5}];
Plot[b, {x, 0, 1}]
f[n_] := Table[i x, {i, n}]
Plot[f[5], {x, 0, 1}]
So, in Plot[expr], if expr has to be evaluated (and produces a list),
the colors will be the same, if not, not?
This seems like pretty unexpected behavior, e.g. a and b above, and
liable to lead to much puzzlement. I would have assumed that the
colors would be assigned *after* the thing to be plotted had been
resolved.
The procedure looks to be (vaguely of course since it's certainly much
more complicated under the hood):
(1) check ' Length' of expr
(2) set whether or not whatever expr evaluates to will have a single
color or a range of colors (but note that the colors can't yet be
assigned since expr has yet to be evaluated and we don't know how many
curves there will be)
(3) evaluate expr
(4) override previous colors decision if an option says
(5) assign colors
Or am I just confused?