简体   繁体   中英

Subplot for Seaborn lmplot

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')

My data has 3 columns like this, so I don't use parameter 'hue' for Facetgrid enter image description here

Please give solutions.

You should use regplot() instead of lmplot() .

From the documentation for 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM