Matplotlib.axis.Tick.get_contains() in Python Last Updated : 01 May, 2022 Comments Improve Suggest changes Like Article Like Report Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and is used for working with the broader SciPy stack. matplotlib.axis.Tick.get_contains() Function The Tick.get_contains() function in axis module of matplotlib library is used to get the custom containing the function of the artist. Syntax: Tick.get_contains(self) Parameters: This method does not accepts any parameter. Return value: This method return the custom contains function of the artist. Below examples illustrate the matplotlib.axis.Tick.get_contains() function in matplotlib.axis: Example 1: Python3 # Implementation of matplotlib function from matplotlib.axis import Tick import matplotlib.pyplot as plt from matplotlib.lines import Line2D import numpy as np from numpy.random import rand fig, ax2 = plt.subplots() ax2.bar(range(10), rand(10), picker=True) for label in ax2.get_xticklabels(): label.set_picker(True) def onpick1(event): if isinstance(event.artist, Line2D): thisline = event.artist xdata = thisline.get_xdata() ydata = thisline.get_ydata() ind = event.ind print('onpick1 line:', np.column_stack([xdata[ind], ydata[ind]])) elif isinstance(event.artist, Rectangle): patch = event.artist print('onpick1 patch:', patch.get_path()) elif isinstance(event.artist, Text): text = event.artist print('onpick1 text:', text.get_text()) Tick.set_contains(ax2, picker=onpick1) ax2.text(0.5, 0.8, "Value Return : " + str(Tick.get_contains(ax2)), fontweight="bold", fontsize=10) fig.suptitle("""matplotlib.axis.Tick.get_contains() function Example\n""", fontweight="bold") plt.show() Output: Example 2: Python3 # Implementation of matplotlib function from matplotlib.axis import Tick import matplotlib.pyplot as plt from matplotlib.lines import Line2D import numpy as np from numpy.random import rand fig, ax = plt.subplots() ax.plot(rand(100), rand(100), 'o') def line_picker(line, mouseevent): if mouseevent.xdata is None: return False, dict() xdata = line.get_xdata() ydata = line.get_ydata() maxd = 0.05 d = np.sqrt( (xdata - mouseevent.xdata)**2 + (ydata - mouseevent.ydata)**2) ind, = np.nonzero(d <= maxd) if len(ind): pickx = xdata[ind] picky = ydata[ind] props = dict(ind=ind, pickx=pickx, picky=picky) return True, props else: return False, dict() Tick.set_contains(ax, picker=line_picker) ax.text(0.1, 0.8, "Value Return : " + str(Tick.get_contains(ax)), fontweight="bold", fontsize=10) fig.suptitle("""matplotlib.axis.Tick.get_contains() function Example\n""", fontweight="bold") plt.show() Output: Comment More infoAdvertise with us Next Article Matplotlib.axis.Tick.get_contains() in Python S SHUBHAMSINGH10 Follow Improve Article Tags : Python Python-matplotlib Matplotlib-Axis Class Practice Tags : python Similar Reads Matplotlib.axis.Axis.get_contains() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack. matplotlib.axis.Axis.get_contains() Function The Axis.get_contains() function i 2 min read Matplotlib.axis.Tick.get_children() in Python matplotlib.axis.Tick.get_children() Function in axis module of matplotlib library is used to get the list of the child Artists of this Artist. Syntax: Tick.get_children(self) Parameters: This method does not accepts any parameter. Return value: This method return the list of the child Artists of th 2 min read Matplotlib.axis.Tick.get_clip_on() in Python Matplotlib is a library in Python and it is a numerical â mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack. matplotlib.axis.Tick.get_clip_on() Function The Tick.get_clip_on() function i 2 min read Matplotlib.axis.Tick.set_contains() function in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack. matplotlib.axis.Tick.set_contains() Function The Tick.set_contains() function i 2 min read Matplotlib.axis.Tick.get_clip_box() in Python Matplotlib is a library in Python and it is a  numerical â mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack. matplotlib.axis.Tick.get_clip_box() Function The Tick.get_clip_box() functio 6 min read Matplotlib.axis.Tick.get_figure() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack. matplotlib.axis.Tick.get_figure() Function The Tick.get_figure() function in ax 2 min read Matplotlib.axes.Axes.get_yticks() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 2 min read Matplotlib.axes.Axes.get_xticks() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. 2 min read Matplotlib.axis.Tick.get_clip_path() in Python Matplotlib is a library in Python and it is a numerical â mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack. matplotlib.axis.Tick.get_clip_path() Function The Tick.get_clip_path() functi 2 min read Matplotlib.axis.Tick.get_gid() in Python Matplotlib is a library in Python and it is numerical â mathematical extension for NumPy library. It is an amazing visualization library in Python for 2D plots of arrays and used for working with the broader SciPy stack. matplotlib.axis.Tick.get_gid() Function The Tick.get_gid() function in axis mod 2 min read Like