I have this code: df_pre_2003.groupby([\'year\'])[\'nAllNeonic\'].sum().plot(col
ID: 3744253 • Letter: I
Question
I have this code:
df_pre_2003.groupby(['year'])['nAllNeonic'].sum().plot(color='red')
plt.title("Neonic usage prior to 2003")
It currently produces a simple line graph. That looks like this
I would like to have a slider implement to it either through plotly or matplotlib. I tried but, was having trouble. For the data here is some sample data. This is just a small sample but I hope it's enough to give a general sense of it. Thank you!
Explanation / Answer
# code take input from cmd line and show graph(use python language)
import matplotlib.pyplot as plt
n =input("What is your length of data table ")#in integer like 10,5
print("Enter your Year and nAllNeonic for whole table")
a=[1997,1994,1993]
b=[6701.4,6651.4,6874.5]
for i in range(0,n):
a.insert( i, input())
b.insert( i, input())
plt.plot(a, b,'r')
plt.xlabel('Year')
plt.ylabel('nAllNeonic Usage')