Skip to content

suggestion: set current ax to g.ax_joint at end of jointplot #2511

@jhncls

Description

@jhncls

Tested with seaborn 0.11.1

jointplot (or JointGrid in general) leaves ax_marg_y as current axis. Some people try to use plt.xlim() or similar and are changing the marginal subplot instead of the main one. It could be nice to automatically set plt.sca(g.ax_joint) when finishing the jointplot.

Example code:

import matplotlib.pyplot as plt
import seaborn as sns

tips = sns.load_dataset('tips')
g = sns.jointplot(data=tips, x='total_bill', y='tip')
# plt.sca(g.ax_joint)
plt.axhline(tips['tip'].mean(), ls='--', c='r')
plt.axhspan(tips['tip'].quantile(.25), tips['tip'].quantile(.75), color='y', alpha=.3)
plt.show()

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions