Matplotlib는 배열의 2D 플롯을 위한 Python의 놀라운 시각화 라이브러리입니다. Matplotlib는 NumPy 어레이를 기반으로 구축되고 더 광범위한 SciPy 스택과 함께 작동하도록 설계된 다중 플랫폼 데이터 시각화 라이브러리입니다.
예
#applying pseudocolor # importing pyplot and image from matplotlib import matplotlib.pyplot as plt import matplotlib.image as img # reading png image im = img.imread('imR.png') # applying pseudocolor # default value of colormap is used. lum = im[:, :, 0] # show image plt.imshow(lum) #colorbar # importing pyplot and image from matplotlib import matplotlib.pyplot as plt import matplotlib.image as img # reading png image im = img.imread('imR.png') lum = im[:, :, 0] # setting colormap as hot plt.imshow(lum, cmap ='hot') plt.colorbar() #interpolation # importing PIL and matplotlib from PIL import Image import matplotlib.pyplot as plt # reading png image file img = Image.open('imR.png') # resizing the image img.thumbnail((50, 50), Image.ANTIALIAS) imgplot = plt.imshow(img) #bicubic value for interpolation # importing pyplot from matplotlib import matplotlib.pyplot as plt # importing image from PIL from PIL import Image # reading image img = Image.open('imR.png') img.thumbnail((30, 30), Image.ANTIALIAS) # bicubic used for interpolation imgplot = plt.imshow(img, interpolation ='bicubic')#sinc value for interpolation # sinc value for interpolation # importing PIL and matplotlib from PIL import Image import matplotlib.pyplot as plt # reading image img = Image.open('imR.png') img.thumbnail((30, 30), Image.ANTIALIAS) # sinc used for interpolation imgplot = plt.imshow(img, interpolation ='sinc')