2
$\begingroup$

I have problem because of the max point and min point, when I have too high or low data point, it just make it white.

Here is example of data

Data = Table[
   1/Sqrt[x^2 + y^2] + Cos[x*y] - 
    1/Sqrt[(x - 0.5)^2 + (y - 0.5)^2], {x, -3.01, 3, 0.1}, {y, -3.01, 
    3, 0.1}];

and I listplot this

ListContourPlot[Data, ContourLabels -> False, Contours -> 20, 
 ColorFunction -> "BlueGreenYellow"]

and I got

enter image description here

I do not like this graph because the white area does not tell me it is max or min, so I adjust the code to fix the max and min as the certain color

Needs["PlotLegends`"]
plTest = ListContourPlot[Data, 
   Contours -> {-5, -2.5, -1, -0.5, -0.25, 0, 0.25, 0.5, 1, 5}, 
   ImageSize -> 720, ColorFunction -> "BlueGreenYellow", 
   PlotRange -> {{0, 60}, {0, 60}, All}];
ShowLegend[plTest, {ColorData["BlueGreenYellow"][1 - #1] &, 30, "max",
   "min", LegendPosition -> {0.7, 0.15}, 
  BaseStyle -> {FontSize -> 14}}]

and I got

enter image description here

but Now I cannot see all the interesting things in the interval that all the small values are in.

Is there any way that I can fix the color of certain interval that max and min points are in and plot contour on just certain range?

$\endgroup$
  • $\begingroup$ What version are you using? ShowLegend was made obsolete in v9. $\endgroup$ – rcollyer Nov 12 '14 at 17:35
3
$\begingroup$

Use option ClippingStyle->Automatic

data = Table[
   1/Sqrt[x^2 + y^2] + Cos[x*y] -
    1/Sqrt[(x - 0.5)^2 + (y - 0.5)^2],
   {x, -3.01, 3, 0.1}, {y, -3.01, 3, 0.1}];

ListContourPlot[data,
 ContourLabels -> Automatic,
 Contours -> 20,
 ColorFunction -> "BlueGreenYellow",
 ClippingStyle -> Automatic,
 PlotLegends -> Automatic]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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