Skip to content

Fix stem(use_line_collection) #13745

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
Mar 24, 2019
Merged

Conversation

timhoffm
Copy link
Member

PR Summary

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0.1, 2 * np.pi, 41)
y = np.exp(np.sin(x))

markerline, stemlines, baseline = plt.stem(x, y, linefmt='grey',
                                           use_line_collection=True)

fails because linefmt is resolved to linestyle = None, which is not a valid parameter value for LineCollection.

The fix is consistent with the behavior of use_line_collection=False.

@timhoffm timhoffm mentioned this pull request Mar 23, 2019
@timhoffm timhoffm added this to the v3.1.0 milestone Mar 23, 2019
@timhoffm timhoffm added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Mar 23, 2019
@timhoffm
Copy link
Member Author

Marking as release critical, because use_line_collection is the recommended way of operation in 3.1, and that should not be broken.

@jklymak
Copy link
Member

jklymak commented Mar 23, 2019

Do we know how this broke?

@timhoffm
Copy link
Member Author

I think this was an oversight in the original implementation and never worked with use_line_collection.

@jklymak
Copy link
Member

jklymak commented Mar 23, 2019

I suppose it could use a test in that case 😉

@timhoffm timhoffm force-pushed the fix-stem-linestyle branch from 8bf4e02 to 9381302 Compare March 23, 2019 16:37
@timhoffm
Copy link
Member Author

Test added.

stemlines = [((xi, bottom), (xi, yi)) for xi, yi in zip(x, y)]
if linestyle is None:
linestyle = 'solid'

Choose a reason for hiding this comment

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

Should this maybe rather evaluate the lines.linestyle rc parameter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Thanks!

@timhoffm timhoffm force-pushed the fix-stem-linestyle branch from 9381302 to 013dfc1 Compare March 24, 2019 00:44
@timhoffm timhoffm mentioned this pull request Mar 24, 2019
6 tasks
@QuLogic QuLogic merged commit bdfeaec into matplotlib:master Mar 24, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 24, 2019
@timhoffm timhoffm deleted the fix-stem-linestyle branch March 24, 2019 09:02
timhoffm added a commit that referenced this pull request Mar 24, 2019
…745-on-v3.1.x

Backport PR #13745 on branch v3.1.x (Fix stem(use_line_collection))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants