Skip to content

Allow xlim as parameter for lmplot #2518

@jhncls

Description

@jhncls

Seaborn versions: latest dev version and 0.11.1

lmplot doesn't seem to accept the xlim= parameter, although FacetGrid does.

Use case: when truncate=False, the regression lines are extrapolated until they touch the current xlims. If one afterwards want to extend these xlims, the regression lines are floating again. A workaround is either to call FacetGrid and regplot separately, or to set very wide xmargins via the rcParams.

Example code.

import seaborn as sns
import matplotlib as mpl

tips = sns.load_dataset('tips')
# mpl.rcParams['axes.xmargin'] = 0.5  # set very wide margins: 50% of the actual range
g = sns.lmplot(x="total_bill", y="tip", col="smoker", data=tips, truncate=False, xlim=(0, 80))
# mpl.rcParams['axes.xmargin'] = 0.05 # set the margins back to the default
g.set(xlim=(0, 80))

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions