Skip to content

Surprising behaviour from plt.style.use('theme'), themes being not exclusive #26779

Open
@kraktus

Description

@kraktus

Thank you for your work on this cornerstone lib.

Bug summary

Not a bug, since documented, but still a surprising behavior from plt.style.use('theme') not resetting values to the default before applying the new ones. Apologies if an issue already exist, didn't find one.

This updates the rcParams with the settings from the style. rcParams not defined in the style are kept.

This is especially an issue when using jupyter notebook for example, where one's would cycle through themes before sticking to one they think look good, while it's a mix of multiple themes and dependent of the order in which they've tried it!

Code for reproduction

plt.style.use("seaborn-v0_8-dark")
plt.style.use("dark_background")
# ...

Actual outcome

Mix of both styles.

Expected outcome

equivalent to

plt.style.use("dark_background")
# ...

Additional information

From what I've seen plotting appearance falls under breaking change, but I don't know how strict this is enforced. I'd expect people willingly setting multiple themes at the same time to get a custom style chimera to be quite small.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions