Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to show multiple image in plt.imshow

import matplotlib.pyplot as plt
def show_images(images: List[numpy.ndarray]) -> None:
    n: int = len(images)
    f = plt.figure()
    for i in range(n):
        # Debug, plot figure
        f.add_subplot(1, n, i + 1)
        plt.imshow(images[i])

    plt.show(block=True)
Comment

plt show 2 images

#subplot(r,c) provide the no. of rows and columns
f, axarr = plt.subplots(2,1) 

# use the created array to output your multiple images. In this case I have stacked 2 images vertically
axarr[0].imshow(img1)
axarr[1].imshow(np.log(img2))

plt.show()
Comment

show multiple matplotlib images

import numpy as np
import matplotlib.pyplot as plt

w = 10
h = 10
fig = plt.figure(figsize=(8, 8))
columns = 4
rows = 5
for i in range(1, columns*rows +1):
    img = np.random.randint(10, size=(h,w))
    fig.add_subplot(rows, columns, i)
    plt.imshow(img)
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: python change column order in dataframe 
Python :: python jokes 
Python :: python randomize a dataframe pandas 
Python :: how to read tuples inside lists python 
Python :: rename key in dict python 
Python :: first 5 letters of a string python 
Python :: how to get only certain columns in pandas 
Python :: drop missing values in a column pandas 
Python :: python big comment 
Python :: how to add three conditions in np.where in pandas dataframe 
Python :: how to delete a csv file in python 
Python :: pandas dataframe from tsv 
Python :: pandas filter every column not null 
Python :: python get response from url 
Python :: joblib 
Python :: try except python 
Python :: python copy an object 
Python :: how to remove stop words in python 
Python :: argeparse can it take a type list 
Python :: python 2d array to dataframe 
Python :: concatenate data vertically python 
Python :: sample data frame in python 
Python :: left join outer apply 
Python :: pandas most frequent value 
Python :: convert excel file to csv with pandas 
Python :: How to search where a character is in an array in python 
Python :: system to extract data from csv file in python 
Python :: playsound error python 
Python :: find the sum of all the multiples of 3 or 5 below 1000 python 
Python :: how to reboot a python script 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =