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.

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.

share|improve this question

marked as duplicate by Kuba, Sjoerd C. de Vries, rm -rf Aug 8 '13 at 15:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

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]
share|improve this answer
    
@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

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