Jun-27-2020, 08:14 PM
I am using the following cursor class called from a data manipulation routine. I simply want to output the date from the xaxis not the x value (0-24) that represents the total count values avaiable on the x axis of the mouse as it is moved in (x).
Currently it outputs correctly (x,y) values as it was intended by whoever wrote this (matplotlib).
I simply want (xdate, y). Where x date is the real xaxis value
I wanted to post a photo but I dont have an url ... its on the local machine?
Basically the values displayed as the mouse moves look like (14.39, 5.32)
Currently it outputs correctly (x,y) values as it was intended by whoever wrote this (matplotlib).
I simply want (xdate, y). Where x date is the real xaxis value
I wanted to post a photo but I dont have an url ... its on the local machine?
Basically the values displayed as the mouse moves look like (14.39, 5.32)
import matplotlib.pyplot as plt import numpy as np import pandas as pd class Cursor(object): def __init__(self, ax): self.ax = ax self.lx = ax.axhline(color='k') # the horiz line self.ly = ax.axvline(color='k') # the vert line # text location in axes coords self.txt = ax.text(0.7, 0.9, '', transform=ax.transAxes) def mouse_move(self, event): if not event.inaxes: return x, y = event.xdata, event.ydata # update the line positions self.lx.set_ydata(y) self.ly.set_xdata(x) self.txt.set_text('x=%1.2f, y=%1.2f' % (x, y)) self.ax.figure.canvas.draw()Any help would be really appreciated