I want to flash the names in the plot when the mouse pointer hover over the points for the salary range.
Below is the data: Year Name Salary 2005 Ron 59000 2005 Sam 62000 2006 Josh 65000 2007 Tim 66000 2008 Pat 68000 2009 Brad 68000 2010 Kim 70000
Below is the code I wrote:
import matplotlib.pyplot as plt import pandas as pd data1 = pd.read_csv("text.csv", delim_whitespace='true') cnt = len(open('text.csv').readlines()) - 1 x = [] for a in range(0,cnt): x.append(a) sal = data1['Salary'][:cnt] plt.plot(x,sal,'g.-') plt.show() How can I flash the names when I hover the mouse over the point in the plot? Please give me an example.
Thanks.
https://stackoverflow.com/questions/65605737/how-to-flash-pop-labels-in-plot-with-mouse-hovering January 07, 2021 at 10:07AM
没有评论:
发表评论