Skip to content

Instantly share code, notes, and snippets.

@konverner
Last active June 8, 2022 08:45
Show Gist options
  • Save konverner/0f07fe62e03835bac547e4d6ffc58602 to your computer and use it in GitHub Desktop.
Save konverner/0f07fe62e03835bac547e4d6ffc58602 to your computer and use it in GitHub Desktop.
display a grid of images in matplotlib.pyplot
def show_img_grid(images, labels, N):
n = int(N**(0.5))
k = 0
f, axarr = plt.subplots(n,n,figsize=(10,10))
for i in range(n):
for j in range(n):
axarr[i,j].set_title(labels[k])
axarr[i,j].imshow(images[k])
k += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment