Last active
October 26, 2021 17:02
-
-
Save TuringNPcomplete/f8b0d57d44a610c76f01500eeaec8852 to your computer and use it in GitHub Desktop.
A modified version of fastai's show_images function that applies an appropriate colormap to 2D images
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
def Dim_Imsshow(ims, nrows=1, ncols=None, titles= None, **kwargs): | |
"Show all images 'ims' as subplots with 'rows' using 'titles'." | |
if ncols is None: ncols = int(math.ceil(len(ims)/nrows)) | |
if titles is None: titles = [None]*len(ims) | |
axs = subplots(nrows, ncols, **kwargs)[1].flat | |
for im,t,ax in zip(ims, titles, axs): | |
if im.ndim < 3: | |
show_image(im, ax = ax, title= t, cmap='gray') | |
else: | |
show_image(im, ax = ax, title= t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment