title: how do i store pcolormesh plot as a numpy array - while preserving data shape?
body: <p>I seem to have some problems storing a plot created using <code>matplotlib.pcolormesh()</code>. As far i know is <code>pcolormesh</code> convert an input data matrix using a colormap. The colormap outputs a RGB value for each entry in the matrix and plots it. </p>
  
  <p>Which in my head would be similar to </p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import matplotlib
  from PIL import Image
  import librosa
  import librosa.display
  from matplotlib import cm
  
  
  fig = plt.figure(figsize=(12,4))
  min = -1.828067
  max = 22.70058
  data =  np.random.uniform(low=min, high=max, size=(474,40))
  librosa.display.specshow(data.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet)
  plt.axis('off')
  plt.show()
  raw_input("sadas")
  
  convert = plt.get_cmap(cm.jet)
  norm = matplotlib.colors.Normalize(vmin=0,vmax=1)
  numpy_output_static = convert(norm(data.T))
  plt.imshow(numpy_output_static,cmap = cm.jet, aspect = 'auto')
  plt.show()
  raw_input("asds")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/bY0FU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bY0FU.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/PKXx7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PKXx7.png" alt="enter image description here"></a></p>
  
  <p>Problem here is that the numpy array of the data being represented as a plot, is not similar to what the first plot shows.  I need the numpy to have data that represents the plot, such that if I wanted to plot it, I would get an identical image as the first one,  and the shape of the numpy array should be similar to the input data which was used in plot 1. </p>
  
  <p>The numpy is being fed to a neural network, for detecting patterns which means that representation is important here. </p>
  
  <p>So how do I make it store the actual plot, without all the red things.. </p>
  
  <p>And if this is not possible in <code>matplotlib</code> what other library would it be possible to do it in. </p>