该图可用来做演示,如果老板要求把梅西写在这张图上,那么就可加上图片注释。
- max_wage = filtered_player_df.Wage.max()
- max_wage_player = filtered_player_df[(player_df['Wage'] == max_wage)]['Name'].values[0]
- g = sns.boxplot(y = "Club",
- x = 'Wage',
- data = filtered_player_df, whis=np.inf)
- g = sns.swarmplot(y = "Club",
- x = 'Wage',
- data = filtered_player_df,
- # Decrease the size of the points to avoid crowding
- size = 7,color='black')
- # remove the top and right line in graph
- sns.despine()
- # Annotate. xy for coordinate. max_wage is x and 0 is y. In this plot y ranges from 0 to 7 for each level
- # xytext for coordinates of where I want to put my text
- plt.annotate(s = max_wage_player,
- xy = (max_wage,0),
- xytext = (500,1),
- # Shrink the arrow to avoid occlusion
- arrowprops = {'facecolor':'gray', 'width': 3, 'shrink': 0.03},
- backgroundcolor = 'white')
- g.figure.set_size_inches(12,8)
- plt.show()

带注释的统计信息和点群,可用于演讲中。
- 看看该图下方的波尔图队,工资预算如此之小,难以和其它高收入的球队们竞争。
- 皇马和巴塞罗那有许多高薪球员。
- 曼联的工资中位数最高。
- 曼联和切尔西注重平等,许多球员的工资水平都差不多。
- 虽然内马尔比梅西更受重视,但梅西和内马尔的工资差距巨大。
由此可知,在这个疯狂的世界中,有些正常只是表面的。
本文讨论了计算和读取不同变量类型之间的相关性、绘制数值数据之间的相关性、以及使用分类散点图绘制分类数据和数值数据之间的相关性。十分有趣的是,可以在Seaborn 中将图表元素叠加在一起。 (编辑:晋中站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|