Add rudimentary themeing support #2929
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a
Plot.theme
method for controlling the appearance of data-independent plot elements, using matplotlib rc parameters.This is a provisional approach for the initial release and will be improved over time.
Currently,
Plot.theme
accepts one positional-only argument, which should be a dictionary of rc parameters. To use "seaborn themes", you can call the relevant functions in theseaborn
namespace (sns
):This is a little clunky; I do expect that it will become possible to use "named' themes more directly, but I am not sure what that interface should look like yet.
This also makes the default theme independent of other matplotlib rc manipulations, including ones performed by
seaborn.set_*
functions. The default theme does match what you'd get when you callsns.set_theme()
with no arguments. There was an attempt to distinguish between "stylistic" rcparams and "logical" params and continue to let matplotlib respect the latter, but the exact set may change in the future.Currently there is no way to change the default for all plots. I expect that will be added later, I am thinking something along the lines of
rather than functions that magically change global state, as currently works with matplotlib.
Why is this feature in a partially-finished state? There are some tricky API decisions here and I am not ready to commit to more complex implementation, do not want to block the initial release, and do want to provide some capacity for customization.