Python数据可视化---------matplotlib多图显示

1 多个子图显示在一个figure中

利用plt.subplot()来生成子图

from keras.preprocessing.image import ImageDataGenerator
import numpy as np
import os
import glob
import skimage.io as io
import skimage.transform as trans
import matplotlib.pyplot as plt
import cv2

img_arr1=io.imread("C:/Users/ZhangRR/Desktop/unet-master/data/membrane/train/image/0.png",as_gray=True)
img_arr2=cv2.imread("C:/Users/ZhangRR/Desktop/unet-master/data/membrane/train/image/0.png",cv2.IMREAD_GRAYSCALE)


plt.subplot(221)
plt.imshow(img_arr1)

plt.subplot(222)
plt.imshow(img_arr2)

plt.show()

2 多个figure显示在一个程序中

利用plt.figure()生成多个figure

from keras.preprocessing.image import ImageDataGenerator
import numpy as np
import os
import glob
import skimage.io as io
import skimage.transform as trans
import matplotlib.pyplot as plt
import cv2

img_arr1=io.imread("C:/Users/ZhangRR/Desktop/unet-master/data/membrane/train/image/0.png",as_gray=True)
img_arr2=cv2.imread("C:/Users/ZhangRR/Desktop/unet-master/data/membrane/train/image/0.png",cv2.IMREAD_GRAYSCALE)

plt.figure()
plt.imshow(img_arr1)

plt.figure()
plt.imshow(img_arr2)

plt.show()

 

你可能感兴趣的:(Python语法注意点,数字图像处理)