plt multiple figures to show

Solutions on MaxInterview for plt multiple figures to show by the best coders in the world

showing results for - "plt multiple figures to show"
Luca
04 Jan 2017
1  
2# create figure
3fig = plt.figure(figsize=(10, 7))
4  
5# setting values to rows and column variables
6rows = 2
7columns = 2
8  
9# reading images
10Image1 = cv2.imread('Image1.jpg')
11Image2 = cv2.imread('Image2.jpg')
12Image3 = cv2.imread('Image3.jpg')
13Image4 = cv2.imread('Image4.jpg')
14  
15# Adds a subplot at the 1st position
16fig.add_subplot(rows, columns, 1)
17  
18# showing image
19plt.imshow(Image1)
20plt.axis('off')
21plt.title("First")
22  
23# Adds a subplot at the 2nd position
24fig.add_subplot(rows, columns, 2)
25  
26# showing image
27plt.imshow(Image2)
28plt.axis('off')
29plt.title("Second")
30  
31# Adds a subplot at the 3rd position
32fig.add_subplot(rows, columns, 3)
33  
34# showing image
35plt.imshow(Image3)
36plt.axis('off')
37plt.title("Third")
38  
39# Adds a subplot at the 4th position
40fig.add_subplot(rows, columns, 4)
41  
42# showing image
43plt.imshow(Image4)
44plt.axis('off')
45plt.title("Fourth")