Thursday, October 9, 2025
HomeLanguagesMatplotlib.axes.Axes.get_picker() in Python

Matplotlib.axes.Axes.get_picker() 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.

matplotlib.axes.Axes.get_picker() Function

The Axes.get_picker() function in axes module of matplotlib library is used to return the picking behavior of the artist.

Syntax: Axes.get_picker(self)

Parameters: This method does not accept any parameters.

Returns: This method the picking behavior of the artist.

Below examples illustrate the matplotlib.axes.Axes.get_picker() function in matplotlib.axes:

Example 1:




#Implementation of matplotlib function
import numpy as np
np.random.seed(19680801)
import matplotlib.pyplot as plt
  
  
volume = np.random.rayleigh(7, size=40)
amount = np.random.poisson(7, size=40)
ranking = np.random.normal(size=40)
price = np.random.uniform(1, 7, size=40)
     
fig, ax = plt.subplots()
     
scatter = ax.scatter(volume,
                     amount,
                     c = ranking,
                     s = price*3,
                     vmin = -3
                     vmax = 3,
                     cmap = "Spectral")
   
legend1 = ax.legend(*scatter.legend_elements(num=5),
                    loc = "upper left",
                    title = "Ranking")
  
ax.add_artist(legend1)
    
ax.text(8, 8,"Value return : " + str(ax.get_picker()),
        fontweight = "bold",
        fontsize=18)
     
fig.suptitle('matplotlib.axes.Axes.get_picker() function \
Example', fontweight="bold")
  
plt.show()


Output:

Example 2:




# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
  
  
X = np.random.rand(10, 200)
xs = np.mean(X, axis = 1)
ys = np.std(X, axis = 1)
  
fig = plt.figure()
ax = fig.add_subplot(111)
line, = ax.plot(xs, ys, 'go-', picker = 5)
  
ax.set_picker(True)
   
ax.text(0.48, 0.3, "Value return : " + str(ax.get_picker()),
        fontweight = "bold",
        fontsize = 18)
    
fig.suptitle('matplotlib.axes.Axes.get_picker()\
function Example', fontweight ="bold")
  
plt.show()


Output:

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32344 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6714 POSTS0 COMMENTS
Nicole Veronica
11877 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11940 POSTS0 COMMENTS
Shaida Kate Naidoo
6834 POSTS0 COMMENTS
Ted Musemwa
7094 POSTS0 COMMENTS
Thapelo Manthata
6789 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS