3
$\begingroup$

I'm trying to make two ListContourPlots with the same contour spacing and colors. One plot has a larger maximum value that seems to be screwing with the even color distribution in the plot:

data1={{17.58,31.56,37.75,108.4,31.19,6.694,1.084},{6.814,17.7,32.47,38.79,31.19,6.694,1.084},{2.206,6.869,18.34,34.87,23.16,6.694,1.084},{0.736,2.083,7.06,20.97,20.81,5.833,1.084},{0.1694,0.6364,2.079,8.16,12.78,5.486,1.084},{0.04068,0.1539,0.6099,2.229,4.654,4.333,0.9476},{0.009418,0.0365,0.1473,0.5622,1.128,1.988,0.8437},{0.002142,0.008397,0.03462,0.1382,0.2465,0.5569,0.5085},{0.0004828,0.001904,0.007927,0.03169,0.05958,0.1205,0.1789}};
data2={{19.15,27.83,30.68,32.37,14.24,3.259,0.5356},{9.017,17.98,27.96,29.4,14.24,3.259,0.5356},{3.734,8.595,18.18,27.71,12.92,3.259,0.5356},{2.117,3.51,8.672,18.88,12.31,2.981,0.5356},{0.2159,1.835,3.509,9.161,8.901,2.904,0.5356},{0.1125,0.2238,1.786,3.616,4.414,2.553,0.4854},{0.05856,0.1167,0.2365,1.625,1.676,1.519,0.4618},{0.03046,0.06072,0.1233,0.2806,0.6536,0.6363,0.3342},{0.01584,0.03159,0.06418,0.1463,0.2562,0.2296,0.165}};

{ListContourPlot[data1,Frame->True,PlotLegends->Automatic,Contours->{1,5,10,15,20,25,30}],
ListContourPlot[data2,Frame->True,PlotLegends->Automatic,Contours->{1,5,10,15,20,25,30}]}

enter image description here

Why are the two color profiles slightly different? I want the color distribution of the first plot to be the same as the second plot. I don't care about the out-of-range data in white on the first plot - it should be the same cream color as the surrounding contour.

$\endgroup$

1 Answer 1

3
$\begingroup$

Use explicit ContourShading. In the code comment there is also how to use other gradients.

data1 = {{17.58, 31.56, 37.75, 108.4, 31.19, 6.694, 1.084}, {6.814, 
    17.7, 32.47, 38.79, 31.19, 6.694, 1.084}, {2.206, 6.869, 18.34, 
    34.87, 23.16, 6.694, 1.084}, {0.736, 2.083, 7.06, 20.97, 20.81, 
    5.833, 1.084}, {0.1694, 0.6364, 2.079, 8.16, 12.78, 5.486, 
    1.084}, {0.04068, 0.1539, 0.6099, 2.229, 4.654, 4.333, 
    0.9476}, {0.009418, 0.0365, 0.1473, 0.5622, 1.128, 1.988, 
    0.8437}, {0.002142, 0.008397, 0.03462, 0.1382, 0.2465, 0.5569, 
    0.5085}, {0.0004828, 0.001904, 0.007927, 0.03169, 0.05958, 0.1205,
     0.1789}};
data2 = {{19.15, 27.83, 30.68, 32.37, 14.24, 3.259, 0.5356}, {9.017, 
    17.98, 27.96, 29.4, 14.24, 3.259, 0.5356}, {3.734, 8.595, 18.18, 
    27.71, 12.92, 3.259, 0.5356}, {2.117, 3.51, 8.672, 18.88, 12.31, 
    2.981, 0.5356}, {0.2159, 1.835, 3.509, 9.161, 8.901, 2.904, 
    0.5356}, {0.1125, 0.2238, 1.786, 3.616, 4.414, 2.553, 
    0.4854}, {0.05856, 0.1167, 0.2365, 1.625, 1.676, 1.519, 
    0.4618}, {0.03046, 0.06072, 0.1233, 0.2806, 0.6536, 0.6363, 
    0.3342}, {0.01584, 0.03159, 0.06418, 0.1463, 0.2562, 0.2296, 
    0.165}};

cont = {1, 5, 10, 15, 20, 25, 30} // Sort;

(*shade=ColorData["TemperatureMap"][#]&/@Rescale[Append[cont,Max[cont]\
+10]];*)

shade = Blend["M10DefaultDensityGradient", #] & /@ 
   Rescale[Append[cont, Max[cont] + 10]];


{ListContourPlot[data1, Frame -> True, PlotLegends -> Automatic, 
  Contours -> cont, ContourShading -> shade], 
 ListContourPlot[data2, Frame -> True, PlotLegends -> Automatic, 
  Contours -> cont, ContourShading -> shade]}

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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