Skip to content

Instantly share code, notes, and snippets.

@okdolly-001
Created April 21, 2018 01:59
Show Gist options
  • Save okdolly-001/f126fd8a527d654b3a4b327ce513d29d to your computer and use it in GitHub Desktop.
Save okdolly-001/f126fd8a527d654b3a4b327ce513d29d to your computer and use it in GitHub Desktop.
Display image and title #jupyter #matplotlib
Set a subplots. Display image and title inside a for-loop.
%matplotlib inline
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
fig, axs = plt.subplots(2,5, figsize=(15, 6), facecolor='w', edgecolor='k')
fig.subplots_adjust(hspace = .5, wspace=.001)
axs = axs.ravel()
for i in range(10):
axs[i].imshow(X_train[10*i+200])
axs[i].set_title(str(y_train[10*i+200]))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment