Data Visualization with Matplotlib

20 / 20

Getting Stared with Matplotlib - Working with Images in Matplotlib

The image module in Matplotlib package provides various functions required for loading, rescaling and displaying image.

Loading image data is supported by the Pillow library. Natively, Matplotlib only supports PNG images.

INSTRUCTIONS
  • First, we will import pyplot and image from matplotlib. We will also import numpy

    import matplotlib.<< your code goes here >> as plt
    import matplotlib.<< your code goes here >> as mpimg
    import << your code goes here >> as np
    
  • Now we will read the image using the imread function

    path = 'https://cloudxlab.s3.amazonaws.com/static/images/aha/matplotlib/introduction_image.png'
    img = mpimg.<< your code goes here >>(path)
    
  • And finally, we will display the image using imshow function

    imgplot = plt.imshow(img)
    
Get Hint See Answer


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...