import matplotlib.pyplot as plt
import seaborn as sns

tips=sns.load_dataset("tips")
g=sns.FacetGrid(
    data=tips,col='sex',row="time",hue="smoker",
    margin_titles=True,palette={"Yes":"g","No":"r"},
    hue_kws={"marker":["v","^"]}
)
g.map(plt.hist,'total_bill',"tip",alpha=0.5,s=100)
plt.show()

代码报错是这样的:

image.png

问一下老师是怎么回事

相关课程:Python 全系列>第十八阶段:数据分析-数据可视化>Seaborn(23旧)>seaborn中FacetGrid绘制网格图

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637