The following two examples work
ContourPlot[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> ColorData[{"TemperatureMap", {0, 1}}]]
ContourPlot[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> ColorData[{"TemperatureMap", "Reverse"}]]
I want to combine those two options, but the following does not work
ContourPlot[Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> ColorData[{"TemperatureMap", "Reverse", {1, 0}}]]
The last plot is just black and I get the message
ColorData::notent: {TemperatureMap, Reverse, {1, 0}} is not a known entity,
class, or tag for ColorData. Use ColorData[] for a list of entities."
The above is just some minimum working example, and if you wonder why I want to do this, read the following: I am making several contourplots that I want to have the same color representing the same values, so I need to specify the values. I also have one set of plots that go from negative to 0, and one set that goes from 0 to some positive value. In the negative case the most negative value represents the largest effect, while in the positive case the most positive value represents the largest effect. I want largest effect in both cases to have the deepest color, so I need to invert one of the colorgradients.
Help is much appreciated.
Edit
I was a bit unclear earlier, but I'll try to calrify now. I have made some more plots to illustrate what I mean. Sorry for the lengthy code.
myColRange[range_] := ColorData[{"StarryNightColors", range}];
cont = 15;
GraphicsGrid[{{
ContourPlot[
-Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> myColRange[{-3, 0}],
ColorFunctionScaling -> False,
Contours -> cont,
PlotLabel ->
"-\!\(\*SuperscriptBox[\(e\), \(\(-\*SuperscriptBox[\(x\), \
\(2\)]\) - \*SuperscriptBox[\(y\), \(2\)]\)]\)"],
Plot3D[
-Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> myColRange[{-3, 0}],
ColorFunctionScaling -> False,
PlotRange -> {{-2, 2}, {-2, 2}, {-3, 0}},
PlotLabel ->
"-\!\(\*SuperscriptBox[\(e\), \(\(-\*SuperscriptBox[\(x\), \
\(2\)]\) - \*SuperscriptBox[\(y\), \(2\)]\)]\)"],
ContourPlot[
-3 Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> myColRange[{-3, 0}],
ColorFunctionScaling -> False,
Contours -> cont,
PlotLabel ->
"-3\!\(\*SuperscriptBox[\(e\), \(\(-\*SuperscriptBox[\(x\), \
\(2\)]\) - \*SuperscriptBox[\(y\), \(2\)]\)]\)"],
Plot3D[
-3 Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> myColRange[{-3, 0}],
ColorFunctionScaling -> False,
PlotRange -> {{-2, 2}, {-2, 2}, {-3, 0}},
PlotLabel ->
"-3\!\(\*SuperscriptBox[\(e\), \(\(-\*SuperscriptBox[\(x\), \
\(2\)]\) - \*SuperscriptBox[\(y\), \(2\)]\)]\)"]},
{ContourPlot[
Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> myColRange[{0, 3}],
ColorFunctionScaling -> False, Contours -> cont,
PlotLabel ->
"\!\(\*SuperscriptBox[\(e\), \(\(-\*SuperscriptBox[\(x\), \(2\)]\
\) - \*SuperscriptBox[\(y\), \(2\)]\)]\)"],
Plot3D[
Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> myColRange[{0, 3}],
ColorFunctionScaling -> False,
PlotRange -> {{-2, 2}, {-2, 2}, {0, 3}},
PlotLabel ->
"\!\(\*SuperscriptBox[\(e\), \(\(-\*SuperscriptBox[\(x\), \(2\)]\
\) - \*SuperscriptBox[\(y\), \(2\)]\)]\)"],
ContourPlot[
3 Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> myColRange[{0, 3}],
ColorFunctionScaling -> False, Contours -> cont,
PlotLabel ->
"3\!\(\*SuperscriptBox[\(e\), \(\(-\*SuperscriptBox[\(x\), \
\(2\)]\) - \*SuperscriptBox[\(y\), \(2\)]\)]\)"],
Plot3D[
3 Exp[-x^2 - y^2], {x, -2, 2}, {y, -2, 2},
ColorFunction -> myColRange[{0, 3}],
ColorFunctionScaling -> False,
PlotRange -> {{-2, 2}, {-2, 2}, {0, 3}},
PlotLabel ->
"3\!\(\*SuperscriptBox[\(e\), \(\(-\*SuperscriptBox[\(x\), \
\(2\)]\) - \*SuperscriptBox[\(y\), \(2\)]\)]\)"]}},
ImageSize -> Large]
The code generates these plots
I am interested in the contourplots, but included the 3D plots to better illustrate what I want.
If you look at one row, the plots have the same range. In the first row the colors changes from -3 to 0, and in the second from 0 to 3. I want to keep it like that: plots in a row have the same scale on the colordata. The scale does not need to be the same for the two different rows, they just happen to be 0 and |3| here because I copy pasted.
What I want now is to reverse the colors of the positive plots in row 2, but I would like to keep the shape of the plot. So I want the peaks to be dark, and then grow lighter closer to 0.
I tried with the pure function proposed by JasonB, but then I get this
myColPure[range_] := (ColorData[{"StarryNightColors", range}][1 - #] &)
Plot3D
and forContourPlot
is that withContourPlot
only one possible value is fed to the color function, the contour level. ForPlot3D
it can be given the x, y, or z values and you need to use the 3rd slot to scale it with the z value, so just#
forContourPlot
and#3
forPlot3D
$\endgroup$