[Matplotlib-users] Matplotlib-plotting-based on different condions from different maps

Jody Klymak jklymak at uvic.ca
Fri May 3 10:39:43 EDT 2019

Hi Adam,

Have a look at `BoundaryNorm` i.e.: https://matplotlib.org/tutorials/colors/colormapnorms.html#discrete-bounds.  Feel free to ask further if you have issues with that.  

However, for your case, you may just want to use pcolormesh and just set the color argument directly.  

Cheers,   Jody

> On May 2, 2019, at  23:53 PM, Mustapha Adamu via Matplotlib-users <matplotlib-users at python.org> wrote:
> Dear all,
> I need some help with regards to colormaps, I am new to python and unsure how to go about it. 
> I have three spatial correlation maps, lets call the A(72x144), B(72X144) and C(72x144) and each one of these are made of of values from -1 to 1. 
> Now I want to generate one single colomap form these based on the following conditions,
> For regions where A > 0.5, B > 0.5 and C > 0.5, make those regions red on the new color map, for regions where A>0.5, B = 0 and C = 0 also make those regions Blue.
> In a coding format I want something like this
> For in range(x):
>   for J in range(y):
>      if A(i,j) >0 & if B(i,J) > 0.5 & if C>0.5:
>        then colormap = Reds.
> This is the general idea I have but dont know how to write this and make it actually work with my code.
> I am open to anwer further questions and I would be most grateful for your help.
> Thanks
> Adam.
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users

More information about the Matplotlib-users mailing list