Skip to content

Fix/rcparams overrides#168

Merged
JamesVarndell merged 3 commits intodevelopfrom
fix/rcparams-overrides
Feb 17, 2026
Merged

Fix/rcparams overrides#168
JamesVarndell merged 3 commits intodevelopfrom
fix/rcparams-overrides

Conversation

@JamesVarndell
Copy link
Collaborator

Description

Closes #83.

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

Copy link
Contributor

@Oisin-M Oisin-M left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @JamesVarndell, nice that you found something to try and amend this behaviour! Broadly speaking, looks good and I don't have any specific comments on the code, but I have some general comments that I think might be important.

From what I saw, this does modify the global params until we call style_context.__exit__, which happens via fig.show() or fig.save(). Therefore, I can foresee two potentially problematic situations which we may want to consider

  1. User is in a jupyter notebook and does not call fig.show() since it's kind of optional there.
  2. User calls plt.show(). I must admit I have done this a few times

Both of these scenarios would result in the global params still being modified in a non-temporary fashion. That said, I am not completely set that we have to support these two cases. It could also be okay to say that those are user errors, but we should decide. Either way, this is still an improvement on the existing behaviour, so I am not blocking

Edit: after some discussion, we have chosen to go with this approach, which also aligns with how seaborn have done things.

@JamesVarndell JamesVarndell merged commit 57ce61b into develop Feb 17, 2026
4 checks passed
@JamesVarndell JamesVarndell deleted the fix/rcparams-overrides branch February 17, 2026 14:32
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 this pull request may close these issues.

import earthkit.plots modifies plt rcParams

2 participants

Comments