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

DOC: seaborn.set_context should note that it sets the global defaults for all plots using the matplotlib rcParams system #3598

Closed
rootsmusic opened this issue Dec 21, 2023 · 6 comments · Fixed by #3599

Comments

@rootsmusic
Copy link

rootsmusic commented Dec 21, 2023

Unless I'm mistaken, the doc for seaborn.set_context should note that it sets the global defaults for all plots using the matplotlib rcParams system.

@mwaskom
Copy link
Owner

mwaskom commented Dec 22, 2023

This is called out in a few places including the Intro page, aesthetics tutorial, and in the docs for the main set_theme function:

This function changes the global defaults for all plots using the matplotlib rcParams system. The themeing is decomposed into several distinct sets of parameter values.

Always hard to know when it becomes counterproductive to redundantly explain basic principles (which I'd consider this) on more focused documentation pages...

@mwaskom
Copy link
Owner

mwaskom commented Dec 22, 2023

Additionally, the page you link says

This affects things like the size of the labels, lines, and other elements of the plot, but not the overall style. This is accomplished using the matplotlib rcParams system.

So I am not sure how much additional explanation to add here? The matplotlib <> seaborn interaction can be a little bit confusing but I'd think that this is conveying the relevant information.

@rootsmusic
Copy link
Author

rootsmusic commented Dec 22, 2023

Additionally, the page you link says

This affects things like the size of the labels, lines, and other elements of the plot, but not the overall style. This is accomplished using the matplotlib rcParams system.

When I read the quoted sentences above, I interpreted "this" to be referring to seaborn.set_context. So my understanding was that they're explaining how this function works. My understanding wasn't that this function sets the global defaults for all plots using the rcParams system.

Indeed, the doc for set_theme does note that "function changes the global defaults for all plots using the matplotlib rcParams system". Since I'm not familiar with rcParams, I'm looking up the doc for set_context to learn if it requires set_theme to also be explicitly called in conjunction.

@mwaskom
Copy link
Owner

mwaskom commented Dec 22, 2023

I'm looking up the doc for set_context to learn if it requires set_theme to also be explicitly called in conjunction.

It does not. set_theme changes multiple parameter groups in one call. set_context changes only a subset of those parameters. Mostly you'll want to be calling set_theme. Probably I wouldn't have added separate set_context, set_style functions these days, but they've been around basically forever.

@rootsmusic
Copy link
Author

rootsmusic commented Dec 22, 2023

This is called out in a few places including the Intro page, aesthetics tutorial, and in the docs for the main set_theme function:

Because I directly referenced the API docs, I didn't come across the tutorials. "Controlling figure aesthetics" is a helpful tutorial. It's linked in the doc for set_style, which similarly explained: "The style parameters control properties like the color of the background and whether a grid is enabled by default. This is accomplished using the matplotlib rcParams system." (You can close this issue. Thanks for clarifying!)

@mwaskom
Copy link
Owner

mwaskom commented Dec 22, 2023

Good point that this docstring should cross-reference to the tutorial page. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants