Re: User defined color function for discrete data set?
- To: mathgroup at smc.vnet.net
- Subject: [mg105787] Re: [mg105777] User defined color function for discrete data set?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 19 Dec 2009 06:25:01 -0500 (EST)
- Reply-to: hanlonr at cox.net
You define the ColorFunction the same in both cases. f[x_] := Exp[-x^2] Exp[2 I x] xlist = Range[-3, 3, .1]; GraphicsColumn[{ Plot[Abs[f[x]], {x, -3, 3}, Filling -> Axis, ColorFunction -> (Hue[Arg[f[#1]]] &)], ListLinePlot[ {#, Abs[f[#]]} & /@ xlist, Filling -> Axis, ColorFunction -> (Hue[Arg[f[#1]]] &)]}] Bob Hanlon ---- Porscha Louise McRobbie <pmcrobbi at umich.edu> wrote: ============= Hello, If I define a complex function, I can easily plot its modulus and color it according to its argument as: f[x_] := Exp[-x^2] Exp[2 I x] Plot[Abs[f[x]], {x, -3, 3}, Filling -> Axis, ColorFunction -> (Hue[ Arg[f[#1]]] &)] I'd like to do the same thing, but now with a discrete set of points. If I have the following plot: xlist = Table[j, {j, -3, 3, .1}]; flist = Table[f[j], {j, -3, 3, .1}]; data = Thread[{xlist, flist}]; ListLinePlot[Thread[{xlist, Abs[flist]}], Filling -> Axis] Using a built-in color scheme is easy, I just add the option ColorFunction->scheme. But how can I define my own color function? Is it possible to use ColorData somehow? My apologies if this is in the Documentation, I cannot seem to find a relevant example. Thanks! Porscha