网络编程
位置:首页>> 网络编程>> Python编程>> 解决seaborn在pycharm中绘图不出图的问题

解决seaborn在pycharm中绘图不出图的问题

作者:KUNLI7  发布时间:2023-11-29 02:22:52 

标签:pycharm,seaborn,绘图

如下所示:


<span style="font-size:18px;">
</span>

import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

np.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( )即可。

来源:https://blog.csdn.net/u012193416/article/details/78562837

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com