seaborn在pycharm中绘图不出图原因

来源:互联网 发布:阿里云音视频 编辑:程序博客网 时间:2024/06/15 22:31

import numpy as npimport seaborn as snsimport matplotlib.pyplot as pltnp.random.seed(sum(map(ord, 'axis_grids')))tips = sns.load_dataset('tips')tips.head()# 将FacetGrid实例化出来g = sns.FacetGrid(tips, col='time')g.map(plt.hist, 'tip')# 散点图把数据描绘出来 alpha透明程度,越小越透明g = sns.FacetGrid(tips, col='sex', hue='smoker')g.map(plt.scatter, 'total_bill', 'tip', alpha=.1)g.add_legend()plt.show()

在代码最后加上plt.show( )即可。