Skip to content

Instantly share code, notes, and snippets.



Last active Nov 10, 2020
What would you like to do?
import PIL.Image
from matplotlib.pyplot import imshow
def show(*Ms):
fig, axs = plt.subplots(ncols=len(Ms))
for M, ax in zip(Ms, (axs if type(axs) == list else [axs])):
M = np.atleast_2d(M)
ax.imshow(PIL.Image.fromarray((M - M.min()) * 255 / M.max()))
ax.set_xticks([0, M.shape[1]])
ax.set_yticks([0, M.shape[0]])
for side in ["right","top","bottom","left"]:
%config InlineBackend.figure_format = 'retina'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment