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.

I have a transient problem of pressure disipation. I want to plot severals 3D plot but I have a problem with colours.

Case:

One of my ListPlot3D presents pressure at time 200 day and the maximum pressure is about 200 kPa in the center of the plot. The secound plot presents pressure at time 1000 day and the maximum pressure is about 1 kPa in the center of the plot. But in the first and in the second plot the maximum value is red.

Question:

How do I set the coulour scale so that it will be always the same i.e. the range of red colour will be about 200 kPa and purple about 0 kPa. Because now in the first plot red colour is 200 kPa and in the secound plot red is 1 kPa.

share|improve this question
2  
No code?$\phantom{}$ –  J. M. May 15 '13 at 12:34
add comment

2 Answers

up vote 2 down vote accepted

Assuming data can be simulated like this: data1 = Table[200 Exp[-x^2 - y^2], {x, -2, 2, 0.1}, {y, -2, 2, 0.1}]; data2 = Table[ 1000 Exp[-x^2 - y^2], {x, -2, 2, 0.1}, {y, -2, 2, 0.1}];

where data1 is the set with a maximum of 200 and data2 is the set with a maximum of 1000, you need the ColorFunctionScaling and ColorFunction parameters in your ListPlot3D set correctly:

plot1 = ListPlot3D[data1, ColorFunctionScaling -> False, 
 ColorFunction -> (ColorData[{"TemperatureMap", {0, 1000}}][#3] &)]
plot2 = ListPlot3D[data2, ColorFunctionScaling -> False, 
 ColorFunction -> (ColorData[{"TemperatureMap", {0, 1000}}][#3] &)]

Plot 1 looks like:

Plot 1

and plot 2 looks like:

Plot 2

share|improve this answer
add comment

When you specify a ColorFunction it uses an absolute scale if you tell it explicitly to not scale it: ColorFunctionScaling->False.

    f[x_] = 1 - (x - 1)^2;
    colfunc = Function[{x, y}, Hue[y]];
    g1 = Plot[f[x], {x, 0, 2}, ColorFunction -> colfunc, 
        ColorFunctionScaling -> False];
    g2 = Plot[f[x]/2, {x, 0, 2}, ColorFunction -> colfunc, 
        ColorFunctionScaling -> False]
    Show[g1,g2]

Same absolute levels in y get the same hue...

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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