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.

I'm generating some figures for a paper. One of them has a pattern like the following figure:

DensityPlot[
 Abs[Exp[-Sqrt[x^2 + y^2]/5] BesselJ[0, Sqrt[x^2 + y^2]]], {x, -20, 
  20}, {y, -20, 20}, ColorFunction -> "SunsetColors", 
 PlotPoints -> 100, PlotRange -> All, PlotRangePadding -> 0, 
 FrameTicksStyle -> 
  Directive[FontFamily -> "Arial", 12, Plain, Thick], 
 ImageSize -> {Automatic, 150}]

modulated Bessel beam

Since the magnitude in the middle could be much higher than that in the outer region, some rings cannot be seen if I print it. In addition, since the pattern represents magnitude, I prefer a kind of "hot" color map to render these data. How can I solve the problem such that the pattern can be seen clearly on a printed copy?

share|improve this question
    
"large data"--I think it may be better to say "wide dynamic range" or something like that; what do you think? –  acl Apr 2 '13 at 16:08
    
yes, you are right. I should say clearly. sorry about that. –  Tony Dong Apr 2 '13 at 16:33
add comment

2 Answers 2

up vote 5 down vote accepted

ColorFunction takes an actual function as input. Thus, eg,

Manipulate[
 DensityPlot[
  Abs[Exp[-Sqrt[x^2 + y^2]/5] BesselJ[0, Sqrt[x^2 + y^2]]], {x, -20, 
   20}, {y, -20, 20}, 
  ColorFunction -> Function[{f}, RGBColor[#, #, #] &@(f^alpha)], 
  PlotPoints -> 100, PlotRange -> All, PlotRangePadding -> 0, 
  FrameTicksStyle -> 
   Directive[FontFamily -> "Arial", 12, Plain, Thick], 
  ImageSize -> {Automatic, 150}],
 {{alpha, .2}, 0.01, 2}
 ]

Mathematica graphics

or with SunsetColors:

Manipulate[
 DensityPlot[
  Abs[Exp[-Sqrt[x^2 + y^2]/5] BesselJ[0, Sqrt[x^2 + y^2]]], {x, -20, 
   20}, {y, -20, 20}, 
  ColorFunction -> (ColorData["SunsetColors"][#^alpha] &), 
  PlotPoints -> 100, PlotRange -> All, PlotRangePadding -> 0, 
  FrameTicksStyle -> 
   Directive[FontFamily -> "Arial", 12, Plain, Thick], 
  ImageSize -> {Automatic, 150}],
 {{alpha, .2}, 0.01, 2}
 ]

Mathematica graphics

share|improve this answer
add comment

Two possibilities:

DensityPlot[Abs[Exp[-Sqrt[x^2 + y^2]/5] BesselJ[0, Sqrt[x^2 + y^2]]]^(
 1/4), {x, -20, 20}, {y, -20, 20},
 ColorFunction -> "SunsetColors",
 PlotPoints -> 100, PlotRange -> All, PlotRangePadding -> 0, 
 FrameTicksStyle -> 
  Directive[FontFamily -> "Arial", 12, Plain, Thick], 
 ImageSize -> {Automatic, 150}]

sqrt

DensityPlot[
 20 Abs[Exp[-Sqrt[x^2 + y^2]/5] BesselJ[0, Sqrt[x^2 + y^2]]], {x, -20,
   20}, {y, -20, 20},
 ColorFunction -> "SunsetColors",
 ColorFunctionScaling -> False,
 PlotPoints -> 100, PlotRange -> All, PlotRangePadding -> 0, 
 FrameTicksStyle -> 
  Directive[FontFamily -> "Arial", 12, Plain, Thick], 
 ImageSize -> {Automatic, 150}]

cutoff

In the first attempt, I raised the small values by taking the fourth root of the Abs. In the second version, I turned off ColorFunctionScaling and multiplied by 20 to raise the small values. In that case, the hight values are cut off.

You can replace the power 1/4 in the first version by 1/2 to darken the lower values.

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.