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


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

Re: ContourPlot ColorFunction Question

From Bob Hanlon <hanlonr@cox.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: ContourPlot ColorFunction Question
Date 2011-06-04 10:19 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <isd0qs$1lm$1@smc.vnet.net> (permalink)

Show all headers | View raw


For ContourPlot, there is only one argument for ColorFunction. That argument is the contour levels.

ContourPlot[x^2 + c - x, {c, -2, 2}, {x, -2, 2},
 ColorFunction -> (If[# > 0, Red, Green] &),
 Contours -> {0}]

Plot[
 Evaluate[x /. Solve[x^2 + c == x, x]],
 {c, -2, 2},
 Frame -> True,
 Axes -> False,
 PlotRange -> {-2, 2},
 AspectRatio -> 1,
 PlotStyle -> {Green, Red}]

Plot[
 x /. Solve[x^2 + c == x, x],
 {c, -2, 2},
 Frame -> True,
 Axes -> False,
 PlotRange -> {-2, 2},
 AspectRatio -> 1,
 ColorFunction -> (If[2 #2 > 1, Red, Green] &)]


Bob Hanlon

---- Jody Sorensen <jodo11@yahoo.com> wrote: 

=============
I'm new to this list and possibly out of my depth, but I'd appreciate any help on this issue. 

We are trying to plot an implicit function using ContourPlot and have the points on the curve colored based on the x and y values (which we call c and x) - specifically based on the value of the derivative. 

We have tried things like the following without success, even though similar commands work with Plot: 
ContourPlot[x^2+c = x, {c, -2, 2}, {x, -2, 2},
 ColorFunction -> (If[2 #1 > 1, Red, Green] &)]

Any suggestions or solutions would be great to hear!

Thanks!
Jody Sorensen


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


Thread

Re: ContourPlot ColorFunction Question Bob Hanlon <hanlonr@cox.net> - 2011-06-04 10:19 +0000

csiph-web