-
Notifications
You must be signed in to change notification settings - Fork 280
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
ENH: avoid implicitly dropping default parameters in plot annotation methods #4475
ENH: avoid implicitly dropping default parameters in plot annotation methods #4475
Conversation
f4e4cbb
to
6cbcc7c
Compare
6cbcc7c
to
9929fa7
Compare
Now fixes #4459. |
I'm not sure this PR qualifies as a bugfix as a whole, because it isn't meant to be 100% backward compatible |
9929fa7
to
b28b559
Compare
b28b559
to
f6ffcac
Compare
I think I've changed my mind. This is a bugfix. And, it fixes a pretty important set of behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do really like **(plot_args or {})
for some reason.
alright let's backport this bad boy then @meeseeksdev backport to yt-4.2.x |
…arameters in plot annotation methods
PR Summary
Many plot annotation methods have 'hidden' internal defaults parameters that may be overriden by users, but passing a single argument (or even an empty dict
plot_args={}
) results in dropping all default parameters.For example
(user wants to override
horizontalalignement
, but the colour is also changed !)In methods that have more than a couple default parameters, this means that the slightest mutation from default behaviour may require a large effort from the user just to replicate the internal defaults.
This doesn't have to be so: we can instead compose parameter sets from internal defaults and user-provided ones.
This is an attempt to implement this composition interface across all plot annotation methods.
Special care is needed to test this because matplotlib may emit warnings about unused parameters with certain combinations. I'll leave this as a draft until I'm confident this is handled properly.