title: Plotting pcolormesh with a bunch of 2-d arrays with different color
body: <p>Here is my question</p>
  <h2>Sorry for the confused expression.</h2>
  <h2>Just check my update. It's more clear.</h2>
  <h3>1. Intro</h3>
  <ul>
  <li>3-d numpy-array <em>&quot;data&quot;</em> with the shape of (10, 31, 37).</li>
  <li>The first dimension 10 is the number of the 2-d arrays</li>
  <li>The last 2 arrays represent some grid value of 2-d area with the value of 0 &amp; 1</li>
  </ul>
  <p>It shows like this:</p>
  <pre><code>### mask the value 0 of data[1,:,:]
  data_mask = np.ma.masked_less(data[[1,:,:],0.001)
  pc =plt.pcolor(xx,yy,data_mask[i,:,:],alpha =1,facecolor = &quot;pink&quot;,edgecolor = 'steelblue',zorder =3)
  ## plotting the grid line
  mesh =plt.pcolor(xx,yy,data[1,:,:],cmap=&quot;gray&quot;,alpha =0.45,facecolor = &quot;none&quot;,edgecolor = 'k')       
  </code></pre>
  <p><a href="https://i.stack.imgur.com/zuwqL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zuwqL.png" alt="Sorry, China don't allow me using imgur" /></a><br />
  <sub>(source: <a href="http://i8.tietuku.com/f3573868c548d7e3.png" rel="nofollow noreferrer">tietuku.com</a>)</sub></p>
  <h3>2. My attempt</h3>
  <ul>
  <li>Plotting each 2-d array with different color in one figure</li>
  <li>If it's possible to plot the cross-section part in another color(like venn diagram) or filling type(&quot;hatch&quot;), :</li>
  </ul>
  <p><a href="https://i.stack.imgur.com/lZsPG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lZsPG.png" alt="" /></a><br />
  <sub>(source: <a href="http://i8.tietuku.com/3f39c4b125286324.png" rel="nofollow noreferrer">tietuku.com</a>)</sub></p>
  <h3>3. My code</h3>
  <p>Two 2-d array for example.<br />
  <a href="https://i.stack.imgur.com/T3SCn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T3SCn.png" alt="" /></a><br />
  <sub>(source: <a href="http://i8.tietuku.com/7b8b67f8422631e1.png" rel="nofollow noreferrer">tietuku.com</a>)</sub></p>
  <pre><code>cs=plt.cm.jet(np.arange(2)/2.)     
  for i in range(0,2,1):
      data_mask = np.ma.masked_less(data[i,:,:],0.001)
      plt.pcolor(xx,yy, data_mask[i,:,:],alpha =0.95,facecolor = cs[i],edgecolor = 'k',zorder =3)      
  </code></pre>
  <p><em>result</em><br />
  <a href="https://i.stack.imgur.com/GnTqa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GnTqa.png" alt="" /></a><br />
  <sub>(source: <a href="http://i8.tietuku.com/13092a81a118e180.png" rel="nofollow noreferrer">tietuku.com</a>)</sub></p>
  <p>These figure all seemed that the color setting was wrong.</p>
  <h3>4. My question</h3>
  <blockquote>
  <ol>
  <li>How to set the pcolor grid color? In my example, using <code>facecolor = </code> didn't work. And I know  using <code>cmap = plt.cm.xxx </code> works(picture below). But I must plot this two 2-d array separately.</li>
  </ol>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/0P8P2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0P8P2.png" alt="" /></a><br />
  <sub>(source: <a href="http://i8.tietuku.com/3c1ccd7252476678.png" rel="nofollow noreferrer">tietuku.com</a>)</sub></p>
  <blockquote>
  <ol start="2">
  <li>As I said in <em>'My attempt 2'</em>, Is there a method to testify the overlapping and label these grid in some smart way.</li>
  </ol>
  </blockquote>
  <p>What I can figure out was generating another np.array named 'overlap' and save the information of each grid</p>
  <pre><code>for i in range(0,data.shape[1],1):
      for j in range(0,dat.shape[2],1):
          if (data[0,i,j] == 1) &amp; (data[1,i,j] == 1.0):
              overlap[i,j] = 1       
  </code></pre>
  <p>When there are more than two 2-d array, this method couldn't cope with.</p>
  <h1>Update -2016-01-17</h1>
  <p>I summarize my question into one figure with the code which generate it:</p>
  <pre><code>cover_mask = np.ma.masked_less(data[0,:,:],0.001)
  plt.pcolor(xx,yy,data_mask[0,:,:],cmap = plt.cm.Set1,alpha =0.75,\
             edgecolor = 'k',zorder =3)      
  
  cover_mask = np.ma.masked_less(cov[1,:,:],0.001)       
  plt.pcolor(xx,yy,cover_mask[1,:,:],cmap = plt.cm.Set2,alpha =0.75,\
             edgecolor = 'k',zorder =3)          
  </code></pre>
  <p><a href="http://i4.tietuku.com/1d47a3410417cd4f.png" rel="nofollow noreferrer">http://i4.tietuku.com/1d47a3410417cd4f.png</a></p>
  <h3>My question</h3>
  <ol>
  <li><p>In the code above, I plot the 2-d arrays separately. If the grid color can be set using <code>facecolor = 'cs[i]'</code> with <code>cs=plt.cm.xxx(np.arange(2)/2.)</code>   , I can loop all of my data[0:10,:,:].But I can only use <code>cmap = xxx</code> to differ each array's color. <strong>I don't know how to loop the colormap.</strong></p>
  </li>
  <li><p>In the picture above, the red grids and the green grids are overlapped. For better visualization effect, I want to label these overlapping grids striked.</p>
  </li>
  </ol>
  <p><em>Idea 1</em></p>
  <ul>
  <li>each 2-d grids has different colors and all overlapping area share the same color(In my case, 11 colors are needed)</li>
  </ul>
  <p><em>Idea 2</em></p>
  <p>label the overlapping grid wiht 'X' or something esle like the figure below.</p>
  <p><a href="https://i.stack.imgur.com/3oGNA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3oGNA.png" alt="" /></a><br />
  <sub>(source: <a href="http://i8.tietuku.com/881c1aacdddd9258.png" rel="nofollow noreferrer">tietuku.com</a>)</sub></p>
  <h3>Add</h3>
  <p>Based on this <a href="https://github.com/matplotlib/matplotlib/issues/3058" rel="nofollow noreferrer">post</a>, it seems that 'pcolor/pcolormesh' don't have the function of setting <code>hatch = '* '</code>.</p>