Tom Tom
Tom Tom

Reputation: 352

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.

Upvotes: 1

Views: 3495

Answers (1)

Diziet Asahi
Diziet Asahi

Reputation: 40667

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.

Upvotes: 2

Related Questions