Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix passing stem markerfmt positionally when locs are not given #23232

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

Merged
merged 1 commit into from
Jun 17, 2022

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Jun 9, 2022

the signature is stem([locs], heads, linefmt=None, ...)

So we should support both:

stem(heads, linefmt='r')
stem(heads, 'r')

We had a kwonly deprecation for 3.5 that was aiming at
stem([locs], heads, *, linefmt=None, ...)
but now I'd rather relax this to
stem([locs], heads, linefmt=None, *, ...)
because it's reasonable to still support stem(heads, 'r'). That's
analogous to plot(y, 'r'). The code overhead for supporting both
positional and keyword passing for the single linefmt parameter
is bearable.

@timhoffm timhoffm added this to the v3.5.3 milestone Jun 9, 2022
@timhoffm timhoffm added PR: bugfix Pull requests that fix identified bugs API: changes labels Jun 9, 2022
_assert_equal(ax.stem(x, y, linefmt='r--'), expected=(x, y))
_assert_equal(ax.stem(x, y, linefmt='r--', basefmt='b--'), expected=(x, y))
_assert_equal(ax.stem(y, linefmt='r--'), expected=([0, 1, 2], y))
_assert_equal(ax.stem(y, 'r--'), expected=([0, 1, 2], y))
Copy link
Member

Choose a reason for hiding this comment

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

Test somewhere that the lines actually are red and dashed?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll do that as part of #23233:
f2f168e

@timhoffm timhoffm force-pushed the stem-fmt branch 2 times, most recently from 78b881e to 3ac90b0 Compare June 10, 2022 18:49
the signature is stem([locs], heads, linefmt=None, ...)

So we should support both:

```
stem(heads, linefmt='r')
stem(heads, 'r')
```

We had a kwonly deprecation for 3.5 that was aiming at
`stem([locs], heads, *, linefmt=None, ...)`
but now I'd rather relax this to
`stem([locs], heads, linefmt=None, *, ...)`
because it's reasonable to still support `stem(heads, 'r')`. That's
analogous to `plot(y, 'r')`. The code overhead for supporting both
positional and keyword passing for the single `linefmt` parameter
is bearable.
@tacaswell tacaswell merged commit 3e9f0b8 into matplotlib:main Jun 17, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jun 17, 2022
@timhoffm timhoffm deleted the stem-fmt branch June 17, 2022 06:58
QuLogic pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jun 21, 2022
timhoffm added a commit that referenced this pull request Jun 21, 2022
…232-on-v3.5.x

Backport PR #23232 on branch v3.5.x (Fix passing stem markerfmt positionally when locs are not given)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: changes PR: bugfix Pull requests that fix identified bugs topic: stem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants