combine colormaps matplotlib

773 views Asked by At

I use matplotlib to plot temperature data for combustion simulations, with temperature in the flame ranging from 3200K - 5500K and temperature outside of the flame ranging from 300K to 1000K. I want to generate projection plots using two different colormaps, one for within the flame and one for outside of it, to show slight variations in both regions. I don't see any temperatures in the intermediate region of 1000K - 3200K, so I waste resolution in my colormap by using one map for the entire 300K - 5500K range. I tried using some of the diverging maps, but they still miss the small variations at the high and low ends.

Does anyone have any suggestions for how to combine two colormaps into one, using one of the colormaps for each temperature range?

EDIT

To make my question more specific: I want to use Matlplotlib's 'hot' colormap for data points in the 3200 - 5500 range and 'cool' for data points in the 300 - 1000 range.

Is there any way to get the source code for these two colormaps, normalize them to their respective start and end points, and combine both into one cmap?

1

There are 1 answers

1
kaminsknator On

Here's a great write up on creating custom color maps: http://cresspahl.blogspot.com/2012/03/expanded-control-of-octaves-colormap.html

You can simply modify the color changes around your data set and leave the portion that's not represented unchanged.