Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jointplot doesn't warn for ax= argument in seaborn 11.2 #2666

Closed
jhncls opened this issue Sep 22, 2021 · 3 comments · Fixed by #2863
Closed

jointplot doesn't warn for ax= argument in seaborn 11.2 #2666

jhncls opened this issue Sep 22, 2021 · 3 comments · Fixed by #2863
Labels

Comments

@jhncls
Copy link

jhncls commented Sep 22, 2021

In seaborn 11.2, figure-level functions such as catplot, relplot, displot and pairplot issue a warning when an ax= parameter is passed:

UserWarning: catplot is a figure-level function and does not accept target axes. You may wish to try stripplot
  warnings.warn(msg, UserWarning)

jointplot doesn't issue such warning

import seaborn as sns
tips = sns.load_dataset('tips')
fig, axs = plt.subplots(1, 2)
sns.jointplot(data=tips, x='total_bill', y='tip', hue='day', ax=axs[0])

PS: Clustermap's message could be confusing (TypeError: heatmap() got multiple values for keyword argument 'ax').

@mwaskom
Copy link
Owner

mwaskom commented Sep 23, 2021

I'm fine with this consistently warning, though I am curious about what one expects to happen here.

@jhncls
Copy link
Author

jhncls commented Sep 23, 2021

A user who isn't very familiar with seaborn might expect that a jointplot behaves as an axes-level function, and that it can be combined with other subplots. So, just a warning jointplot is a figure-level function and does not accept target axes could point them in the right direction. (Related SO post: https://stackoverflow.com/questions/69286147/subplot-seaborn-white-box-failure )

@mwaskom
Copy link
Owner

mwaskom commented Sep 23, 2021

I understand why the distinction between "figure-level" and "axes-level" is confusing for non-faceted {dis,rel,cat}plot, but isn't it obvious that a jointplot can't be plotting on a single axes, since there is more than one of them in the plot?

Unlike the plots built on a FacetGrid, there's no axes-level correspondent to direct users towards here.

@mwaskom mwaskom added the ux label Oct 5, 2021
mwaskom added a commit that referenced this issue Jun 16, 2022
- Warn/ignore when `ax` is passed as kwarg (closes #2666)
- Set the joint axes to be active (closes #2511)
mwaskom added a commit that referenced this issue Jun 16, 2022
- Warn/ignore when `ax` is passed as kwarg (closes #2666)
- Set the joint axes to be active (closes #2511)
mwaskom added a commit that referenced this issue Jun 16, 2022
- Warn/ignore when `ax` is passed as kwarg (closes #2666)
- Set the joint axes to be active (closes #2511)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants