-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate passing drawstyle with linestyle as single string. #12442
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
Conversation
d8ee5e6
to
f49b106
Compare
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.
Minor comments, do with them as you like.
cbook.warn_deprecated( | ||
"3.1", message="Passing the drawstyle with the linestyle " | ||
"as a single string is deprecated since Matplotlib " | ||
"%(since)s and support will be removed %(removal)s; " |
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.
removed in
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.
%(removal)s
includes it.
lib/matplotlib/lines.py
Outdated
"3.1", message="Passing the drawstyle with the linestyle " | ||
"as a single string is deprecated since Matplotlib " | ||
"%(since)s and support will be removed %(removal)s; " | ||
"please pass the drawstyle separately ('drawstyle=...' or " |
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.
-0.5 on quoting 'drawstyle=...'
. Might lead to confusion with strings. Alternative:
please pass the drawstyle separately using the drawstyle (or ds) keyword arguments.
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.
done
Instead of `plt.plot(..., linestyle="steps--")`, use `plt.plot(..., linestyle="--", drawstyle="steps")`. `ds` is now an alias for `drawstyle`. Note that `plt.plot(..., "steps--")` already doesn't work (due to confusion as to whether "steps" is a color, a marker or a drawstyle). The end goal is to simplify and rationalize linestyle specification as rcParams vs. as arguments.
f49b106
to
d35c3a7
Compare
Why are we adding an alias to keywords? I'm 👎 on the ds alias and 👍 on the rest. |
@NelleV I understand your argument against aliases, and have been on the same page. However, when working interactively a lot, I've come to appreciate, being able to write So -0.5 on |
I’m good w the alias. Even if you script, not typing “linestyle” each time would be a nice convenience. |
Whether we should fully get rid of aliases is a good question (I agree with @jklymak that they have their usefulness) but I think it's better to be consistent and provide aliases for everything for now rather than have an inconsistent alias system. Adding ds=drawstyle is not going to make the whole alias system harder to deprecate if we really choose to go that route. |
👍 on the separation of drawstyle and linestyle/other params. I don't know how often a construct like I don't have a strong opinion on the alias. I was wondering if it would be good to add tests for deprecations like this? I.e. a test that the intended use case ( |
I don't think any of the current maintainers would allow such a thing to pass review. Our test suite is already huge enough that I wouldn't bother (there are better parts where to improve the coverage, and that doesn't necessarily mean strict numerical improvements, but rather combos of kwargs which don't work well together, see e.g. the discussion on hist/align...). |
Instead of
plt.plot(..., linestyle="steps--")
, useplt.plot(..., linestyle="--", drawstyle="steps")
.ds
is now an alias fordrawstyle
.Note that
plt.plot(..., "steps--")
already doesn't work (due toconfusion as to whether "steps" is a color, a marker or a drawstyle).
The end goal is to simplify and rationalize linestyle specification as
rcParams vs. as arguments (#11797).
PR Summary
PR Checklist