[英]Subplot for Seaborn lmplot
I want to create a 1X2 plot, I try subplot but lmplot don't have parameter 'ax', Not work我想创建一个 1X2 plot,我尝试 subplot 但 lmplot 没有参数'ax',不起作用
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')
My data has 3 columns like this, so I don't use parameter 'hue' for Facetgrid enter image description here我的数据有 3 列这样的,所以我不使用参数 'hue' 用于 Facetgrid在此处输入图像描述
Please give solutions.请给出解决方案。
You should use regplot()
instead of lmplot()
.您应该使用regplot()
而不是lmplot()
。
From the documentation for lmplot:从 lmplot 的文档中:
Notes笔记
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. regplot() 和 lmplot() 函数密切相关,但前者是轴级别的 function,而后者是图形级别的 function,它结合了 regplot() 和 FacetGrid。
ALTERNATIVELY You could "melt" your dataframe and use lmpolot()
to generate a FacetGrid with your three data columns.或者,您可以“融化”您的dataframe并使用lmpolot()
使用您的三个数据列生成 FacetGrid。 But you haven't provided a copiable code for your dataframe, so I cannot tell you the exact syntax you would need.但是您还没有为您的 dataframe 提供可复制的代码,所以我无法告诉您您需要的确切语法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.