Friday, November 21, 2025
HomeLanguagesMatplotlib.axes.Axes.format_cursor_data() in Python

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

The Axes.format_cursor_data() function in axes module of matplotlib library is used to return a string representation of data.

Syntax: Axes.format_cursor_data(self, data)

Parameters: This method accept the following parameter as discussed below:

  • data: This parameter is the data which is used to be used.

Returns: This method returns the string representation of data.

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

Example 1:




# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
      
np.random.seed(10**7)
neveropenx = np.random.randn(10)
  
fig, ax = plt.subplots()
ax.plot(neveropenx)
  
ax.text(1.5, 0.85, "Value return by format_cursor_data():",
        fontweight ="bold"
  
ax.text(0, 0.7, ax.format_cursor_data(neveropenx))
   
fig.suptitle('matplotlib.axes.Axes.format_cursor_data() \
function Example', fontweight ="bold")
  
plt.show()


Output:

Example 2:




# Implementation of matplotlib function
import numpy as np
import matplotlib.pyplot as plt
  
      
neveropenx = np.array([24.40, 110.25, 20.05,
                   22.00, 61.90, 7.80
                   15.00])
     
fig, ax = plt.subplots()
ax.plot(neveropenx, 'go-')
  
ax.text(1, 95, "Value return by format_cursor_data():",
        fontweight ="bold"
  
ax.text(1.3, 85, ax.format_cursor_data(neveropenx))
   
fig.suptitle('matplotlib.axes.Axes.format_cursor_data()\
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
32405 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6783 POSTS0 COMMENTS
Nicole Veronica
11928 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11997 POSTS0 COMMENTS
Shaida Kate Naidoo
6907 POSTS0 COMMENTS
Ted Musemwa
7167 POSTS0 COMMENTS
Thapelo Manthata
6862 POSTS0 COMMENTS
Umr Jansen
6847 POSTS0 COMMENTS