Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

enter image description here

I want to get the effect in the above Figure. Here is my code:

Plot3D[Log[
   4*((1 + x)^2)*(0.0065^2)*Log[y]/(3*((1 - 2 x))^2*(0.0267^2)) + 1]/
  Log[y], {x, 0.315, 0.45}, {y, 0, 1}, Mesh -> 50, ImageSize -> 600, 
 AspectRatio -> 0.8, PlotRange -> {0, 20}, 
 PerformanceGoal -> "Quality", 
 LabelStyle -> Directive[Bold, FontFamily -> "Times New Roman", 24], 
 AxesStyle -> {Thick, Thick, Thick}, AxesOrigin -> {0.315, 0, 0}, 
 AxesLabel -> {\[Nu], n, l}, MaxRecursion -> 6, ClippingStyle -> None,
  ColorFunction -> "Rainbow", 
 PlotLegends -> BarLegend[Automatic, LegendMarkerSize -> {20, 300}]]
share|improve this question
1  
I get the desired color function since you have already specified it with ColorFunction -> "Rainbow" in your code. –  Kardashev3 Dec 23 '13 at 10:38
    
@Kardashev3 It doesn't look like his example images because it is darker and more muted. See my answer for my best guess as to what Scott wants. –  Mr.Wizard Dec 23 '13 at 11:07
    
ah, some materials science at long last ;-) –  Yves Klett Dec 27 '13 at 18:59
add comment

3 Answers 3

The color function used is the standard "jet" colormap that is ubiquitous in figures generated using MATLAB. This answer (by J. M.) has an exact ColorFunction for reproducing the jet colormap:

jet[u_?NumericQ] := Blend[
    {{0, RGBColor[0, 0, 9/16]}, {1/9, Blue}, {23/63, Cyan}, {13/21, Yellow},
    {47/63, Orange}, {55/63, Red}, {1, RGBColor[1/2, 0, 0]}}, 
    u] /; 0 <= u <= 1

share|improve this answer
    
Is it just me or does this actually not match the original images very well? Maybe it's the shape of the surface. *shrug* –  Mr.Wizard Dec 23 '13 at 12:04
    
@Mr.Wizard OP never included a plot of the original image, so it's all in the scaling. If you observe carefully, the colors in my bar legend matches that in OP's examples. I do not think yours (Yves') is correct or that Glow is necessary here. –  rm -rf Dec 23 '13 at 12:07
    
Yeah, it's the shape of the surface. This looks right: Plot3D[x + y, {x, 0, 1}, {y, 0, 1}, ColorFunction -> (jet[#3] &)] (+1 of course) –  Mr.Wizard Dec 23 '13 at 12:07
    
@rm-rf I was just pointing to Blend, no claim to the correct ingredients thereof. –  Yves Klett Dec 27 '13 at 18:24
add comment

I am betting that you are seeking Glow. Using Yves's gradient in:

Edit: Looking again at your gradient it is closer to leave out Green entirely:

ColorFunction -> (Glow @ Blend[{Blue, Cyan, Yellow, Red}, #3] &)

We get:

Plot3D[
  Log[4*((1 + x)^2)*(0.0065^2)*Log[y]/(3*((1 - 2 x))^2*(0.0267^2)) + 1]/Log[y], 
  {x, 0.315, 0.45}, {y, 0, 1},
  PlotRange -> {0, 20}, Mesh -> 50, MaxRecursion -> 6, 
  ColorFunction -> (Glow @ Blend[{Blue, Cyan, Yellow, Red}, #3] &)
]

enter image description here

Notably the back side remains bright:

enter image description here

You may also wish to make the ends Darker, e.g.:

ColorFunction -> (Glow @ 
    Blend[{Darker@Blue, Blue, Cyan, Yellow, Red, Darker@Red}, #3] &)
share|improve this answer
    
It is enlightening!tks –  Scott Wang Dec 23 '13 at 12:20
add comment

I would like to draw your attention to Blend, which is very useful for custom gradient coloring. Taken more or less directly from the documention:

Graphics[Table[{Blend[{Blue, Cyan, Green, Yellow, Red}, x], 
   Disk[{8 x, 0}]}, {x, 0, 1, 1/8}]]

Mathematica graphics

You may want to adjust/weigh the blending to your liking - see the docs for further enlightment.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.