Re: Just primitive ColorFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg87385] Re: Just primitive ColorFunction
- From: ucervan at gmail.com
- Date: Wed, 9 Apr 2008 05:55:08 -0400 (EDT)
- References: <ftfej7$bu7$1@smc.vnet.net> <ftfk8g$fab$1@smc.vnet.net>
You could also use: Plot[Sin[x], {x, 0, 4 Pi}, AxesOrigin -> {0, 0}, Axes -> {True, True}, PlotStyle -> Thick, ColorFunction -> (If[Sin[#] >= 0, RGBColor[1, 0, 0], RGBColor[0, 0, 1]] &), Filling -> Axis, ImageSize -> {380, 280}, ColorFunctionScaling -> False, FillingStyle -> Automatic] Note that the output will be much bigger since VertexColors are generated for each vertex. Also, segments crossing the x axis will have end vertices of different colors, so some color bleeding will occur. This kind of plots are useful to represent "spectrum" coloring as in: Plot[Sin[x], {x, 0, 4 Pi}, AxesOrigin -> {0, 0}, Axes -> {True, True}, PlotStyle -> Thick, ColorFunction -> (ColorData["VisibleSpectrum"][ 380 + # (750 - 380)] &), Filling -> Axis, ImageSize -> {380, 280}, ColorFunctionScaling -> True, FillingStyle -> Automatic] -Ulises Cervantes WRI