Re: weird behavior when plotting multiple functions in 6.0
- To: mathgroup at smc.vnet.net
- Subject: [mg76075] Re: weird behavior when plotting multiple functions in 6.0
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 16 May 2007 05:18:39 -0400 (EDT)
- Organization: Uni Leipzig
- References: <f2btov$iga$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, and when you say f[x_] = {Sin[x], Cos[x]}; Plot[Evaluate[f[x]], {x, 0, 4*Pi}] the curves again red and blue, because Plot[] has the attribute HoldAll, and so it can't see that f[x] results a list of functions instead of a single one. In version 6.0 Plot[] has a new option Plot[f[x], {x, 0, 4*Pi}, Evaluated -> True] that will also fix the problem. Regards Jens Roman wrote: > Hello all: > > When I plot > Plot[{Sin[x], Cos[x]}, {x, 0, 4*Pi}] > I get two curves: one blue, one red. > > But when I do > f[x_] = {Sin[x], Cos[x]}; > Plot[f[x], {x, 0, 4*Pi}] > both curves are blue. It is as if at some level Mathematica does not > understand that I'm actually plotting two curves at a time, and uses > the first color specification (blue) for both curves. > > This is particularly annoying when you want to play with plot styles, > for example filling instructions, like > Filling -> {1 -> -1, 2 -> 1} > which works in the first example but not in the second one. > > Has anyone figured out a workaround for this one? > > Thanks! > Roman. > >