Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>&gt;&gt;&gt; M = NP.empty((5, 5), dtype=NP.object) # a 2D NumPy array &gt;&gt;&gt; M array([[None, None, None, None, None], [None, None, None, None, None], [None, None, None, None, None], [None, None, None, None, None], [None, None, None, None, None]], dtype=object) </code></pre> <p>Now you can insert sequences, without getting the <em>ValueError</em> </p> <pre><code>&gt;&gt;&gt; M[2,2] = NP.array([4, 3, 5]) &gt;&gt;&gt; M array([[None, None, None, None, None], [None, None, None, None, None], [None, None, [4 3 5], None, None], [None, None, None, None, None], [None, None, None, None, None]], dtype=object) &gt;&gt;&gt; M[2,2] array([4, 3, 5]) </code></pre> <p>The other part of the OP--passing an Array like this to Matplotlib's <strong><em>imshow</em></strong>, is a problem.</p> <p><em><strong>imshow</em></strong> visually represents a 2D array as a cloud of points positioned on the canvas according to their x, y indices. The value at that index is indicated according to different colors and color intensities based on a colormap which maps color to array value. Therefore, valid arguments for <em>imshow's</em> data parameter are:</p> <ul> <li>NumPy 2D arrays</li> </ul> <p>NumPy arrays of higher dimension in two (and only these two AFAIK) which imshow can interpret as</p> <ul> <li><p>NumPy 2D array of <strong><em>rgb tuples</em></strong> (x, y, r, b, g)</p></li> <li><p>NumPy 6D arrays, which are interpreted as a 2D array of <strong><em>rgba tuples</em></strong> (x, y, r, g, b, a)</p></li> </ul>
    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.
    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