0
$\begingroup$

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.

$\endgroup$
1

2 Answers 2

2
$\begingroup$

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

$\endgroup$
2
$\begingroup$

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

$\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.