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

  • Thread starter Thread starter hanson
  • Start date Start date
  • Tags Tags
    Color Plot
Click For Summary
The discussion centers around creating a colored contour plot in Mathematica, specifically with negative values represented in blue and positive values in red, including a gradient between these colors. Users suggest utilizing the contour options, particularly the ColorFunction feature, to achieve the desired effect. A specific syntax example is provided, indicating the use of RGBColor to define the color gradient. The original poster later finds a user-created Mathematica notebook that meets their requirements, resolving their issue.
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.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K