新闻详情
Python数据可视化-seaborn - osc_15umdlds的个人空间 - OSCHINA...
来自 : 开源中国
发布时间:2021-03-25
import matplotlib.pyplot as plt
import numpy as np
plt.rc(\'font\', family=\'SimHei\', size=13)
num = np.array([13325, 9403, 9227, 8651])
ratio = np.array([0.75, 0.76, 0.72, 0.75])
men = num * ratio
women = num * (1-ratio)
x = [\'聊天\',\'支付\',\'团购\\n优惠券\',\'在线视频\']
width = 0.5
idx = np.arange(len(x))
plt.bar(idx, men, width, color=\'red\', label=\'男性用户\')
plt.bar(idx, women, width, bottom=men, color=\'yellow\', label=\'女性用户\') #这一块可是设置bottom,top,如果是水平放置的,可以设置right或者left。
plt.xlabel(\'应用类别\')
plt.ylabel(\'男女分布\')
plt.xticks(idx+width/2, x, rotation=40)
plt.legend()
plt.show()
2018年1月17日distplot( )为hist加强版,kdeplot( )为密度曲线图 import matplotlib.pyplot as plt import seaborn as sns df_iris = pd.read_csv('../input/iris...iris,matplotlib,kde,osc_15umdlds,,Python数据可视化-seaborn - osc_15umdlds的个人空间,OSCHINA博客Seaborn其实是在matplotlib的基础上进行了更高级的API封装,从而使得作图更加容易,在大多数情况下使用seaborn就能做出很具有吸引力的图。这里实例采用的数据集都是seaborn提供的几个经典数据集,dataset文件可见于Github。本博客只总结了一些,方便博主自己查询,详细介绍可以看seaborn官方API和example gallery,官方文...Python数据可视化
本文链接: http://dfdist.immuno-online.com/view-762428.html
发布于 : 2021-03-25
阅读(0)
最新动态
2021-03-25
2021-03-25
2021-03-25
2021-03-25
2021-03-25
2021-03-25
2021-03-25
2010-08-17
2021-03-25
2021-03-25
2021-03-25
2021-03-25
品牌分类
其他
联络我们