matplotlib.pyplot.imread() in Python Last Updated : 12 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.imread() Function: The imread() function in pyplot module of matplotlib library is used to read an image from a file into an array. Syntax: matplotlib.pyplot.imread(fname, format=None) Parameters: This method accepts the following parameters. fname : This parameter is the image file to read. format: This parameter is the image file format assumed for reading the data. Returns: This method return the following. imagedata : This returns the image data Below examples illustrate the matplotlib.pyplot.imread() function in matplotlib.pyplot: Example #1: Python3 1== # Implementation of matplotlib function import numpy as np import matplotlib.cbook as cbook import matplotlib.image as image import matplotlib.pyplot as plt with cbook.get_sample_data('loggf.png') as image_file: image = plt.imread(image_file) fig, ax = plt.subplots() ax.imshow(image) ax.axis('off') plt.title('matplotlib.pyplot.imread() function Example', fontweight ="bold") plt.show() Output: Example #2: Python3 1== # Implementation of matplotlib function import numpy as np import matplotlib.cbook as cbook import matplotlib.image as image import matplotlib.pyplot as plt with cbook.get_sample_data('loggf.png') as file: im = image.imread(file) fig, ax = plt.subplots() ax.plot(np.cos(10 * np.linspace(0, 1)), '-o', ms = 15, alpha = 0.6, mfc ='green') ax.grid() fig.figimage(im, 10, 10, zorder = 3, alpha =.5) plt.title('matplotlib.pyplot.imread() function Example', fontweight ="bold") plt.show() Output: Comment More infoAdvertise with us Next Article matplotlib.pyplot.figure() in Python S SHUBHAMSINGH10 Follow Improve Article Tags : Python Python-matplotlib Practice Tags : python Similar Reads matplotlib.pyplot.figure() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read matplotlib.pyplot.figure() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.draw() in Python matplotlib.pyplot.draw() function redraw the current figure in Matplotlib. Unlike plt.show(), it does not block the execution of code, making it especially useful in interactive sessions, real-time visualizations where the plot needs to update dynamically without pausing the program. Example: Python 2 min read Matplotlib.pyplot.draw() in Python matplotlib.pyplot.draw() function redraw the current figure in Matplotlib. Unlike plt.show(), it does not block the execution of code, making it especially useful in interactive sessions, real-time visualizations where the plot needs to update dynamically without pausing the program. Example: Python 2 min read Matplotlib.pyplot.gci() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Matplotlib.pyplot.gci() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read Like