matplotlib subplots - too many indices for array : <p>I'm quite confused with the way plt.subplots work</p>

<p>This snippet works - displays a 2 by 2 Layout</p>

<pre><code>fig, axs = plt.subplots(2,2, figsize=(20, 10))
axs[0,0].set_title('Sobel')
axs[0,0].imshow(sobelx)
axs[0,1].set_title('S Channel')
axs[0,1].imshow(s_channel)
axs[1,0].set_title('Combined Binary')
axs[1,0].imshow(combined_binary)
axs[1,1].set_title('Color Stack')
axs[1,1].imshow(color_stack)
</code></pre>

<p>This snippet doesn't work - 1 by 2 Layout</p>

<pre><code>fig, axs = plt.subplots(1,2, figsize=(20, 10))
axs[0,0].set_title('Undistorted Image')
axs[0,0].imshow(undistort_img)
axs[0,1].set_title('Warped Image')
axs[0,1].imshow(warped_img)
</code></pre>

<p>This errors out with <code>IndexError: too many indices for array</code></p>

<p>When I print axs shape, it is <code>(2, 2)</code> in the first case where as <code>(2,)</code> in the second case. What is this axs ? And how do i make the 2nd piece of code work?</p>
