I have a dataframe like follows:
df = pd.DataFrame({'year': [1,2,3],
'number' :[4,5,6],
'points': [10000,20000,30000]})
What is the easiest way to plot a figure that shows the relationship between number and points in each year? (ie, x-axis is "number" , y-axis is "points" and legend is "year")
I like using holoviews, you can use hvplot ( https://hvplot.holoviz.org/ ) for this:
import hvplot.pandas
df = pd.DataFrame({'year': [1,2,3],
'number' :[4,5,6],
'points': [10000,20000,30000]})
df.hvplot.scatter(x='number', y='points', color='year', clabel='year')
output:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.