Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[Mathematica]Frustratedhow to color a plot according to the values?

  1. May 12, 2009 #1
    Hi all.
    I have been searching over the web for some time, kind of frustrated...
    I would like to plot the contourplot of a function, and I would like the contourplot to be colored.
    The rule is that...the negative values should be blue in colors and the positive values should be red in colors, but I also want some gradient between these two limits...
    I suppose this can be quite easily done, but I still don't know how to do that...
    Anyone knows? Please help. Thanks.
  2. jcsd
  3. May 13, 2009 #2
    Try playing with the contour option:
    contour-># of contour lines
    and contourstyle

    they should be in the help context
  4. May 13, 2009 #3

    http://documents.wolfram.com/mathematica/functions/ColorFunction [Broken]

    I can't remember the syntax (haven't had a Mathematica license in years), but you want something like ColorFunction -> (RGBColor[1.0#, 0.0, (1.0-1.0#)]&) or similar - you can fiddle with the constants to change the parametric variation, even make it nonlinear if you want.
    Last edited by a moderator: May 4, 2017
  5. May 24, 2009 #4
    Thanks for the replies!
    I have found a user-written Mathematica notebook which do exactly what i want. Thanks.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Similar Threads for Mathematica Frustratedhow color
Mathematica Storing Mathematica output
Mathematica Mathematica to MATLAB
Mathematica Cannot do the integral of the Hyper-geometric function?
Mathematica Cannot Plot This Function in Mathematica
Mathematica While Loop in Mathematica