data = {'year': ['2010', '2011','2012','2013','2014','2015','2016','2017','2018','2019','2020','2021'],
'points': [2260, 1499, 1834,3712,6830,7139.0,8085,6928,6903,8631,5476,1271]}
df = pd.DataFrame(data)
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="darkgrid")
sns.histplot(data=df['points'],x=df['year'],color="blue")
plt.show()
Here is my code, but the graph doesn't look like what I hope to be. I want it to look like with x-axis is labelled as the years, and the y-axis shows the different hight of points. How to fix it?
I think you are using the wrong type of plot, how about a barplot
?
sns.set(style="darkgrid")
ax = sns.barplot(x="year", y="points", data=data)
plt.show()