Seaborn lmplot的子图 [英] Subplot for Seaborn lmplot
问题描述
我想创建一个1X2图,我尝试创建子图,但是lmplot没有参数'ax',不起作用
I want to create a 1X2 plot, I try subplot but lmplot don't have parameter 'ax', Not work
f, axes = plt.subplots(1, 2, figsize=(10, 5))
sns.lmplot(data = table2, x='hour_6_10', y = 'all_day', ax = axes[0])
我想将这些行用于子图:
I want to use these line for subplot:
sns.lmplot(data = table2, x='hour_6_10', y = 'all_day')
sns.lmplot(data = table2, x='hour_0_10', y = 'all_day')
我的数据有3列,因此,我不为Facetgrid使用参数'hue'在此处输入图片描述
My data has 3 columns like this, so I don't use parameter 'hue' for Facetgrid enter image description here
请提供解决方案.
推荐答案
您应使用摘自lmplot文档:
From the documentation for lmplot:
注释
regplot()和lmplot()函数密切相关,但是前者是轴级功能,而后者是图形级结合了regplot()和FacetGrid的函数.
The regplot() and lmplot() functions are closely related, but the former is an axes-level function while the latter is a figure-level function that combines regplot() and FacetGrid.
替代您可以您的数据帧,并使用 lmpolot()
生成包含三个数据列的FacetGrid.但是您尚未为数据框提供可复制的代码,因此我无法告诉您所需的确切语法.
ALTERNATIVELY
You could "melt" your dataframe and use lmpolot()
to generate a FacetGrid with your three data columns. But you haven't provided a copiable code for your dataframe, so I cannot tell you the exact syntax you would need.
这篇关于Seaborn lmplot的子图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!