# How to make a bi-variate or 2-dimension colormap?

Dear all matplotlib users,

I
am trying to make a geographical map with colors, in which the colors of pixels will depend on 2-dimensions of (x,y), like the one attached from one publication. I searched online and this is where I arrive:

https://gist.github.com/ChaoYue/81eb01b558f068f11ee741c56557a6a2

To
put it short, I know how to pick up color by x-axis value, and use y-axis value as an indicator of either saturation, or brightness or transparency of the color. Or somewhere to convert this (x,y) information back to linear space and select color from a matplotlib colormap. But is there some way that I can use different colors for each
corner of the small square as shown in the example, and somewhere interpolate the colors in between? like the one attached?

These are the online sources that help me, even though I am not sure I fully understand the tricks inside them …:

http://stackoverflow.com/questions/15207255/is-there-any-way-to-use-bivariate-colormaps-in-matplotlib

https://github.com/matplotlib/matplotlib/issues/4369

Thanks a lot in advance for any suggestions,

Cheers,

Chao

···

On Mon, Jul 25, 2016 at 4:34 PM, Chao YUE <chaoyuejoy@…287…> wrote:

Dear all matplotlib users,

I am trying to make a geographical map with colors, in which the colors of pixels will depend on 2-dimensions of (x,y), like the one attached from one publication. I searched online and this is where I arrive:

https://gist.github.com/ChaoYue/81eb01b558f068f11ee741c56557a6a2

To put it short, I know how to pick up color by x-axis value, and use y-axis value as an indicator of either saturation, or brightness or transparency of the color. Or somewhere to convert this (x,y) information back to linear space and select color from a matplotlib colormap. But is there some way that I can use different colors for each corner of the small square as shown in the example, and somewhere interpolate the colors in between? like the one attached?

These are the online sources that help me, even though I am not sure I fully understand the tricks inside them …:

http://stackoverflow.com/questions/15207255/is-there-any-way-to-use-bivariate-colormaps-in-matplotlib

https://github.com/matplotlib/matplotlib/issues/4369

Thanks a lot in advance for any suggestions,

Cheers,

Chao

http://www.globalcarbonatlas.org/

Chao YUE

postdoc at LSCE

CEA-Ormes des Merisiers, F-91191 GIF-SUR-YVETTE CEDEX
Tel: 33 1 69 08 41 87