0
$\begingroup$

I have two ListContourPlots which have different min and max height values.

plot1 = ListContourPlot[{{1, 1, 2}, {1, 2, 4}, {1, 3, 6}, {2, 1, 
    3}, {2, 2, 1}, {2, 3, 1}, {3, 1, 2}, {3, 2, 9}, {3, 3, 12}}, 
  Contours -> Range[0, 20, 1], PlotLegends -> Automatic]

plot2 = ListContourPlot[{{1, 1, 13}, {1, 2, 17}, {1, 3, 16}, {2, 1, 
    3}, {2, 2, 20}, {2, 3, 19}, {3, 1, 2}, {3, 2, 19}, {3, 3, 13}}, 
  Contours -> Range[0, 20, 1], PlotLegends -> Automatic]

I would like to ensure that same height values get the same color, ie both plots should have a scale from 0 to 20.

$\endgroup$
0

1 Answer 1

0
$\begingroup$

What you need is a ColorFunction of your choice and ColorFunctionScaling->False:

CoolColor[ z_ ] := RGBColor[z/20, 1 - z/20, 1]

plot1 = ListContourPlot[{{1, 1, 2}, {1, 2, 4}, {1, 3, 6}, {2, 1, 
    3}, {2, 2, 1}, {2, 3, 1}, {3, 1, 2}, {3, 2, 9}, {3, 3, 12}}, 
  Contours -> Range[0, 20, 1], ColorFunction -> CoolColor, 
  ColorFunctionScaling -> False]

plot2 = ListContourPlot[{{1, 1, 13}, {1, 2, 17}, {1, 3, 16}, {2, 1, 
    3}, {2, 2, 20}, {2, 3, 19}, {3, 1, 2}, {3, 2, 19}, {3, 3, 13}}, 
  Contours -> Range[0, 20, 1], ColorFunction -> CoolColor, 
  ColorFunctionScaling -> False]
$\endgroup$
2
  • $\begingroup$ @Nasser With the same ColorFunction it has the same scale? Actually I am using MMA 8 and can't use PlotLegends so I removed it and the results are different. $\endgroup$
    – A Rizona
    Commented Aug 8, 2013 at 14:36
  • $\begingroup$ @Nasser Hm I don't get any kind of PlotLegend or PlotLegends work for MMA8 with ListContourPlot, but now I understand what you mean. My answer refered to the "same height values get the same colour". $\endgroup$
    – A Rizona
    Commented Aug 8, 2013 at 14:50

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