Matplotlib.pyplot.findobj() in Python Last Updated : 21 Apr, 2020 Comments Improve Suggest changes Like Article Like Report Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. matplotlib.pyplot.findobj() This function is used to recursively find all instances of artists contained in the artist. Filters are created to match for the artist object which finds and returns a list of matched artists. An artist object refers to the object of matplotlib.artist class that is responsible for rendering the paint on the canvas. Syntax: matplotlib.pyplot.findobj(o=None, match=None, include_self=True) Parameters: match: This parameter is used for the creating filter to match for the searched artist object. This can be one of three things; None: This returns all objects in artist. A function: A function with signature such as def match(artist: Artist) -> boolean. The result from this function has artists for which the function returns True. A class instance: The result of this contain artist of the same class or one of its subclasses(isinstance check), eg, Line2D include_self:This parameter accepts a boolean value and it includes itself to me checked for the list of matches. Returns: It returns a list of Artist Example 1: Python3 1== import matplotlib.pyplot as plt import numpy as np h = plt.figure() plt.plot(range(1,11), range(1,11), gid = 'dummy_data') legend = plt.legend(['the plotted line']) plt.title('figure') axis = plt.gca() axis.set_xlim(0,5) for p in set(h.findobj(lambda x: x.get_gid() == 'dummy_data')): p.set_ydata(np.ones(10)*10.0) plt.show() Output: Example 2: Python3 1== import numpy as np import matplotlib.pyplot as plt import matplotlib.text as text m = np.arange(3, -4, -.2) n = np.arange(3, -4, -.2) o = np.exp(m) p = o[::-1] figure, axes = plt.subplots() plt.plot(m, o, 'k--', m, p, 'k:', m, o + p, 'k') plt.legend((' Modelset', 'Dataset', 'Total string length'), loc ='upper center', shadow = True) plt.ylim([-1, 10]) plt.grid(True) plt.xlabel(' Modelset --->') plt.ylabel(' String length --->') plt.title('Min. Length of String') # Helper function def find_match(x): return hasattr(x, 'set_color') and not hasattr(x, 'set_facecolor') # calling the findobj function for obj in figure.findobj(find_match): obj.set_color('black') # match on class instances for obj in figure.findobj(text.Text): obj.set_fontstyle('italic') plt.show() Output: Comment More infoAdvertise with us Next Article Matplotlib.pyplot.findobj() in Python R RajuKumar19 Follow Improve Article Tags : Python Write From Home Python-Library Python-matplotlib Practice Tags : python Similar Reads Matplotlib.pyplot.grid() in Python matplotlib.pyplot.grid() function in Matplotlib is used to toggle the visibility of grid lines in a plot. Grid lines help improve readability of a plot by adding reference lines at major and/or minor tick positions along the axes. Example:Pythonimport matplotlib.pyplot as plt fig, ax = plt.subplots( 3 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.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 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.draw() Function The draw() function in pyplot module of matplotlib library is used to r 1 min read Matplotlib.pyplot.ginput() 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.axis() in Python axis() function in Matplotlib is used to get or set properties of the x- and y-axis in a plot. It provides control over axis limits, aspect ratio and visibility, allowing customization of the plotâs coordinate system and view. It's key feature includes:Gets or sets the axis limits [xmin, xmax, ymin, 3 min read Matplotlib.pyplot.annotate() 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. matplotlib.pyplot.annotate() Function The annotate() function in pyplot module of matplotlib library is u 3 min read Matplotlib.pyplot.gca() in Python Matplotlib is a library in Python and it is a numerical - mathematical extension for the NumPy library. Pyplot is a state-based interface to a Matplotlib module that provides a MATLAB-like interface.  matplotlib.pyplot.gca() Function The gca() function in pyplot module of matplotlib library is used 2 min read Matplotlib.pyplot.get_fignums() 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.axes() in Python axes() method in Matplotlib is used to create a new Axes instance (i.e., a plot area) within a figure. This allows you to specify the location and size of the plot within the figure, providing more control over subplot layout compared to plt.subplot(). It's key features include:Creates a new Axes at 3 min read Like