Last active
November 10, 2020 01:03
-
-
Save alexlenail/aceec39c5cb789c542a7ea4ba5210c92 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]: | |
ax.spines[side].set_visible(False) | |
%config InlineBackend.figure_format = 'retina' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment