Use the same scale for two ListContour plots [duplicate]

This question already has an answer here:

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.

-

marked as duplicate by Kuba, Sjoerd C. de Vries, R. M.♦Aug 8 '13 at 15:23

This question was marked as an exact duplicate of an existing question.

1 Answer

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]

-
@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. – A Rizona Aug 8 '13 at 14:36
@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". – A Rizona Aug 8 '13 at 14:50