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
Deprecate passing formatting parameters positionally to stem() #21126
Conversation
e68a2bf
to
07cbdfc
Compare
I hardly ever use stem() myself, so I can't claim to have much experience, but my guess is that |
Will come back after #21127 and decide if we should deprecate nevertheless. |
It's rather a foot cannon. One can be tempted to define the marker here (which I would consider a more common change than the line). But that does not work. This format string only applies to the stem lines and marker information is silently ignored. Actually even one of our tests is trying to do that: matplotlib/lib/matplotlib/tests/test_axes.py Line 3653 in 1cec9c1
The '*' here is ignored. Also, the stem3d signature already has On a side note, the
raises
|
e6bf835
to
1c66f56
Compare
Regarding your side point, that's because linefmt is already kwonly in the example you give. |
lib/matplotlib/tests/test_axes.py
Outdated
|
||
|
||
def test_stem_dates(): | ||
fig, ax = plt.subplots(1, 1) | ||
xs = [dateutil.parser.parse("2013-9-28 11:00:00"), | ||
dateutil.parser.parse("2013-9-28 12:00:00")] | ||
ys = [100, 200] | ||
ax.stem(xs, ys, "*-") | ||
ax.stem(xs, ys, linefmt="*-") |
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.
But the *
is still ignored here?
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.
Sure. Actually, the linefmt
doesn't do anything at all here. Solid is already the default, so we can just remove the parameter.
This will allow to simplify the implementation because, currently, `stem(*args, linefmt=None, ...)` still tries to resolve excess positionally passed args, to *linefmt* and following parameters, which is quite a bit of logic. OTOH, since we have 3 formats, passing them positionally is already difficult from a usability/readability perspective, because they can easily be mixed up.
1c66f56
to
88cdf1b
Compare
@timhoffm do you still want this to be merged for 3.5? |
The deprecation reduces the risk of unnoticed misuse, so the sooner this gets in the better. OTOH it's not very important. It should not hold up a release or put somebody under pressure to react to it for 3.5. |
… positionally to stem()
…126-on-v3.5.x Backport PR #21126 on branch v3.5.x (Deprecate passing formatting parameters positionally to stem())
Deprecate passing formatting parameters positionally to stem()
Deprecate passing formatting parameters positionally to stem()
PR Summary
This will allow to simplify the implementation because, currently,
stem(*args, linefmt=None, ...)
still tries to resolve excesspositionally passed args, to linefmt and following parameters, which
is quite a bit of logic (see
# fallback to positional argument
commentsin the implementation).
OTOH, since we have 3 formats, passing them positionally is already
difficult from a usability/readability perspective, because they can
easily be mixed up.