[英]create seaborn plot with pandas of matplotlib
我正在努力用熊貓或matplotlib(重新)創建一個海洋情節。
數據幀:
wage = pd.melt(pd.read_html('https://en.wikipedia.org/wiki/List_of_countries_by_average_wage')[8].iloc[:5],
id_vars=['Country'],var_name='Year', value_name='Wage')
print(wage.sample(n=7))
結果:
Country Year Wage
29 Netherlands 2013 52808
38 United States 2015 60692
4 Netherlands 2000 47596
9 Netherlands 2005 49939
23 United States 2012 58669
46 Switzerland 2017 62283
12 Iceland 2010 44558
使用seaborn的情節很簡單:
fig, ax = plt.subplots(figsize=(15, 7))
sns.lineplot(x='Year', y='Wage', hue='Country', linewidth=3, data=wage, ax=ax)
ax.set_title('Development of average annual wages 2000–2017 (US$ PPP)', fontsize=16)
plt.show()
但是我想用熊貓使用wage.plot()
或matplotlib
創建相同的情節。 有什么建議怎么做?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.