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

  • Context: Mathematica 
  • Thread starter Thread starter hanson
  • Start date Start date
  • Tags Tags
    Color Plot
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 6K views
hanson
Messages
312
Reaction score
0
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.
 
Physics news on Phys.org
Try playing with the contour option:
contour-># of contour lines
and contourstyle

they should be in the help context
 
ColorFunction

http://documents.wolfram.com/mathematica/functions/ColorFunction

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:
Thanks for the replies!
I have found a user-written Mathematica notebook which do exactly what i want. Thanks.