title: array to image using the matplotlib
body: <p>I am trying to predict the depths from a single. the prediction is in .mat structure </p>
  
  <pre><code>{'__header__': b'MATLAB 5.0 MAT-file Platform: nt, Created on: Mon Jun 24 20:53:06 2019', '__version__': '1.0', '__globals__': [], 'mat': array
  
   ([[[[45.593273 ],
       [44.393333 ],
       [45.71833  ],
       ...,
       [20.923761 ],
       [22.743704 ],
       [25.33584  ]],
  
      [[44.40423  ],
       [43.71836  ],
       [45.744335 ],
       ...,
       [17.319963 ],
       [18.493673 ],
       [19.687391 ]],
  
      [[45.414154 ],
       [45.360767 ],
       [46.82794  ],
       ...,
       [17.41372  ],
       [18.701914 ],
       [19.105356 ]],
  
      ...,
  
      [[ 6.8809724],
       [ 6.5185905],
       [ 6.602861 ],
       ...,
       [ 6.6090174],
       [ 6.587162 ],
       [ 7.3165007]],
  
      [[ 7.0013733],
       [ 6.384803 ],
       [ 6.6147423],
       ...,
       [ 6.46376  ],
       [ 6.434711 ],
       [ 7.4840846]],
  
      [[ 7.9435554],
       [ 6.6214004],
       [ 6.654035 ],
       ...,
       [ 7.4519753],
       [ 7.712751 ],
       [ 9.646708 ]]]], dtype=float32)}  
  </code></pre>
  
  <p>The final element mat is of the array type. I want to take the mat array and plot using matplotlib. </p>
  
  <p>When I get the type and shape of the above I get this </p>
  
  <p>The type of array is  <code>&lt;class 'numpy.ndarray'&gt;</code>.
  The shape of the array is  <code>(1, 96, 320, 1)</code>.</p>
  
  <p>I am not able to understand what does this means <code>(1, 96, 320, 1)</code> never seen such kind of shape with 4 parameters.</p>
  
  <pre class="lang-py prettyprint-override"><code>import scipy.io as sio 
  import numpy as np
  import matplotlib.pyplot as plt
  mat_content = sio.loadmat('2011_09_26_drive_0002_sync_image_0000000023_image_02.mat')
  #print(mat_content)
  print(mat_content.keys())
  array_content = mat_content['mat']
  print(array_content)
  print('The type of array is ',type(array_content)) 
  print('The shape of array is ', array_content.shape)
  #plt.plot(array_content) 
  #plt.show()
  
  </code></pre>
  
  <p>when I run the above code I get this error </p>
  
  <pre class="lang-py prettyprint-override"><code>Traceback (most recent call last):
    File "2.py", line 11, in &lt;module&gt;
      plt.plot(array_content)
    File "C:\Users\snanr\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 2811, in plot
      is not None else {}), **kwargs)
    File "C:\Users\snanr\Anaconda3\lib\site-packages\matplotlib\__init__.py", line 1810, in inner
      return func(ax, *args, **kwargs)
    File "C:\Users\snanr\Anaconda3\lib\site-packages\matplotlib\axes\_axes.py", line 1611, in plot
      for line in self._get_lines(*args, **kwargs):
    File "C:\Users\snanr\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 393, in _grab_next_args
      yield from self._plot_args(this, kwargs)
    File "C:\Users\snanr\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 370, in _plot_args
      x, y = self._xy_from_xy(x, y)
    File "C:\Users\snanr\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 234, in _xy_from_xy
      "shapes {} and {}".format(x.shape, y.shape))
  ValueError: x and y can be no greater than 2-D, but have shapes (1,) and (1, 96, 320, 1)
  
  </code></pre>
  
  <p>I expect the output to be able to use the array and plot the array as an image using matplotlib.</p>