# Remove part of TemperatureMap Color function

I am using here some random contour plot as an example. I have this ContourPlot:

ContourPlot[Sin[3 x + y^2], {x, -3, 3}, {y, -3, 3},
ColorFunction -> "TemperatureMap", PlotRange -> {-1, 1}]


I have the TemperatureMap in ColorFunction which takes color from red to blue. However, some referee asks me to implement only the "blue" part of TemperatureMap, I tried to play with Rescale but I never remove completely the "red" part.

If we can see the value of color in number, Red can be 0 and Blue equals to 1. I just want the color between 0.5 to 1. Google didn't give me answers ..

Thank you

• ColorFunction -> "Blue" will give only the blue part. Commented Nov 29, 2021 at 16:31
• ContourPlot[Sin[3 x + y^2], {x, -3, 3}, {y, -3, 3}, ColorFunction -> (ColorData["TemperatureMap"][ Rescale[#, {-1, 1}, {0, .5}]] &), PlotRange -> {-1, 1}, ColorFunctionScaling -> False]?
– kglr
Commented Nov 29, 2021 at 20:39
• @DanielHuber But ColorFunction->"Blue"  is not a gradient. However the rescaling from the comments of the answer is perfect. @kglr, it's almost what I wanted but with your comment, we kept a little bit the "yellow" part coming from the red part of the TemperatureMap. Commented Nov 30, 2021 at 10:48

Not sure exactly what you mean by "only the blue part". You can experiment with this

ContourPlot[Sin[3 x + y^2], {x, -3, 3}, {y, -3, 3},
ColorFunction -> (ColorData["TemperatureMap"][Rescale[#, {.5, 1}]] &),
PlotRange -> {-1, 1},
ColorFunctionScaling -> False]


Change the {.5, 1} to select parts of the color gradient.

• Hum, that was I tested before, but there is no shade of blue. Here there is only one or two shade of blue. For example if you rescale from {-1,1 }, you will find a lot of shades of blue before to coming to the red color. They ask me to have something like for example the "DeapSeaColors" ColorFunction, with several shades of blue, but if I can have them from TemperatureMap. Commented Nov 29, 2021 at 16:41
• Okay I played with the {.5, 1} , I also changed the CorlorFunctionScaling in True. I thought that I can choose only value between 0 and 1. I currently have what I wanted, thank you ! Commented Nov 29, 2021 at 16:45
• Don't know enough about scaling, but try: ContourPlot[ Sin[3 x + y^2] , {x, -3, 3}, {y, -3, 3} , PlotRange -> {-1, 1} , ColorFunctionScaling -> True , ColorFunction -> (ColorData["TemperatureMap"][ Rescale[#, {0, 2.4}]] &) , PlotLegends -> Automatic ]
– Syed
Commented Nov 29, 2021 at 17:00
• @Syed Yes this rescale works perfectly for this function. Actually directly when I have the info that we can rescale more that between 0 to 1 helped me a lot and I found the perfect rescale for the referee Commented Nov 30, 2021 at 10:47
• @G.Sophys In addition to scaling of colors and mapping them onto a range, I was not sure about reds being at 0, and blues at 1.1 (so briefly tried to invert the scale as well...) and therefore didn't have the confidence to offer an answer, but I am glad it has worked for your referees and you.
– Syed
Commented Nov 30, 2021 at 10:50