Generating user-defined colormap in Python matplotlib
<h3>Here is my question.</h3>

<p>When I want use a lot of colormap, I could use    </p>

<pre><code>CMAP = ["summer_r", "brg_r", "Dark2", "prism", "PuOr_r", "afmhot_r", "terrain_r", "PuBuGn_r", "RdPu", \
        "gist_ncar_r", "gist_yarg_r", "Dark2_r", "YlGnBu", "RdYlBu", "hot_r"]
## value was a 3-d array, the first dimension represent the amount of 2-d array with the value (0, 1).     
## I just plot the value 1 for each value[i,:,:]
for i in range(0,len(CMAP),1):
    plt.pcolor(xx,yy,value[i,:,:], cmap = CMAP[i])      
</code></pre>

<p>And I can get this:     </p>

<p><a href="http://i8.tietuku.com/cdcdcd5f539c124b.png" rel="nofollow noreferrer">http://i8.tietuku.com/cdcdcd5f539c124b.png</a>    </p>

<p>But I can't clearly realize the each grid's color befor generating the figure.<br>
Because some colormap which I add in <strong>CMAP</strong> may have the same start color. SO, some value[ i, :, :] grids will be hard to distinguish.         </p>

<h3>My idea</h3>

<blockquote>
  <p>Using one colormap instead and split into single color for each value[ i, :, :]. So, each value grid has a different color.   </p>
</blockquote>

<p>For example:     </p>

<pre><code>## 1. cut the colormap, take "jet" for example      
cMap = plt.cm.get_cmap("jet",lut=6)      
</code></pre>

<p><a href="http://i4.tietuku.com/be127c44e87a03fc.png" rel="nofollow noreferrer">http://i4.tietuku.com/be127c44e87a03fc.png</a>         </p>

<pre><code>## 2. I havn't figured it out     
## This is the fake code 
CMAP = Func[one color -&gt; colormap](cMap)    
</code></pre>

<h3>Update -2016-01-18</h3>

<p>This is my code to set different cmap and loop, but it was a bit of rigid.   </p>

<pre><code>cmap1 = colors.ListedColormap(["w",'red'])
cmap2 = colors.ListedColormap(["w",'blue'])
cmap3 = colors.ListedColormap(["w",'yellow'])    

CMAP = [cmap1,cmap2,cmap3] 
</code></pre>

<p>Then, I can cope with my original attempt.    </p>

<p>But I was wondering is there a smart way to generate the cmap1,cmap2,......?</p>