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


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

Bug with map in conjuntion with plotstyle?

From Jason Quinn <jason.lee.quinn@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Bug with map in conjuntion with plotstyle?
Date 2011-04-06 09:11 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <inhaoq$27q$1@smc.vnet.net> (permalink)

Show all headers | View raw


values = {0.5, 1.0, 2.0};

f[x_, y_] := x^2 + y

Plot[{f[x, #]} & /@ values, {x, 0, 6}, PlotStyle -> {{Red}, {Blue},
{Yellow}}]

thing = {f[x, #]} & /@ values

Plot[thing, {x, 0, 6}, PlotStyle -> {{Red}, {Blue}, {Yellow}}]



I'm trying to use map to generate a list of functions to plot and use
PlotStyle to define the color and style of the plot. Unfortunately, it
seems like there's a bug here. When map is used with Plot, it applies
the first plotstyle to all the plots.

I think the above is a good test case. The first plot only plots red.
The second plot plots red, blue, and green as desired.

Am I misunderstanding something about plot, map, or plot style? Or is
this a bug?

Jason

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


Thread

Bug with map in conjuntion with plotstyle? Jason Quinn <jason.lee.quinn@gmail.com> - 2011-04-06 09:11 +0000

csiph-web