4

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 this one extracted from one publication:

Lowerleft corner is the 2-dimension colorbar legend whose color depends changes of two variables

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 somehow to convert this (x,y) information back to linear space and select color from a matplotlib colormap. But the question is, for example, suppose I want the color as lowerleft=blue,lowerright=green; upperleft=red,upperright=orange. How can I interpolate the color of pixels in between? Or maybe this example is in contradiction with color theory and it is not possible? The equivalent question is: how can I make a colorbar legend like the figure shown in the above?

These are the online sources that help me, but they don't directly give the instructions I am looking for:

Is there any way to use bivariate colormaps in matplotlib?

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

Community
  • 1
  • 1
wiswit
  • 5,599
  • 7
  • 30
  • 32

0 Answers0