Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Unless you really need the marker ticks and such,</p> <pre><code>im._rgba_cache </code></pre> <p>gives you direct access to the MxNx4 <code>numpy</code> array that is the color mapped data.</p> <p>If you just want the color mapped data, you can by pass <code>imshow</code> entirely and directly color-map the data your self (see <a href="http://matplotlib.org/users/colormaps.html" rel="nofollow noreferrer">guide</a> for picking your color map)</p> <pre><code>my_cm = maplotlib.cm.get_cmap('Reds') normed_data = (data - np.min(data)) / (np.max(data) - np.min(data)) mapped_data = my_cm(normed_data) </code></pre> <p>which will give you back a MxNx4 array mapped between <code>0</code> and <code>1</code>, </p> <pre><code>mapped_datau8 = (255 * my_cm(normed_data)).astype('uint8') </code></pre> <p>or</p> <pre><code>mapped_data = my_cm(normed_data, bytes=True) </code></pre> <p>will convert it to unsigned ints.</p> <p><code>matplotlib</code> includes a range of normalization code, <a href="http://matplotlib.org/api/colors_api.html?highlight=lognorm#matplotlib.colors.Normalize" rel="nofollow noreferrer">see here</a>.</p> <p><a href="http://matplotlib.org/api/cm_api.html#matplotlib.cm.get_cmap" rel="nofollow noreferrer"><code>get_cmap</code> doc</a> and <a href="http://www.loria.fr/~rougier/teaching/matplotlib/#colormaps" rel="nofollow noreferrer">colormap gallery</a></p> <p>edit: fixed oversight pointed out at <a href="https://stackoverflow.com/a/14880947/380231">https://stackoverflow.com/a/14880947/380231</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload