MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ContourPlot ColorFunction Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119444] Re: ContourPlot ColorFunction Question
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sat, 4 Jun 2011 06:20:03 -0400 (EDT)
  • Reply-to: comp.soft-sys.math.mathematica at googlegroups.com

This looks amazingly similar to an answer I gave on the Mathematica student forum a couple  of days ago (http://forums.wolfram.com/student-support/topics/25780). Together with your sentence "We are trying to plot..." this smells like a homework assignment.

Anyway I can tell you that you shouldn't use a signal '=' in your plot function, but a '==' (but probably, if you want to see multiple contour levels you should delete the right hand side) and the  ColorFunction -> (If[2 #1 > 1, Red, Green] &) part worked for Plot (as I used it on the student forum) where #1 is the x coordinate (see documentation of ColorFunction), so 2 #1 would indeed be the derivative of a function like y = x^2. Alas, for ContourPlot, the ColorFunction gets passed the values of the contour levels. Multiplying this with 2 doesn't have anything to do with derivatives.

For starters, you might want to read some docs about contourplots, and you really should try to understand more deeply what they depict. Otherwise this whole exercise isn't getting you anywhere.


  • Prev by Date: Curve fit for piecewise - Lazy evaluation (Defer / Hold?) on constraint passed to Minimize[]?
  • Next by Date: Re: ContourPlot ColorFunction Question
  • Previous by thread: ContourPlot ColorFunction Question
  • Next by thread: Re: ContourPlot ColorFunction Question