Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bc6e26f

Browse filesBrowse files
QuLogicMeeseeksDev[bot]
authored andcommitted
Backport PR #13745: Fix stem(use_line_collection)
1 parent afc4e61 commit bc6e26f
Copy full SHA for bc6e26f

File tree

Expand file treeCollapse file tree

2 files changed

+15
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+15
-1
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2779,8 +2779,9 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
27792779

27802780
# New behaviour in 3.1 is to use a LineCollection for the stemlines
27812781
if use_line_collection:
2782-
stemlines = []
27832782
stemlines = [((xi, bottom), (xi, yi)) for xi, yi in zip(x, y)]
2783+
if linestyle is None:
2784+
linestyle = rcParams['lines.linestyle']
27842785
stemlines = mcoll.LineCollection(stemlines, linestyles=linestyle,
27852786
colors=linecolor,
27862787
label='_nolegend_')

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3070,6 +3070,19 @@ def test_stem(use_line_collection):
30703070
ax.legend()
30713071

30723072

3073+
@check_figures_equal(extensions=['png'])
3074+
def test_stem_params(fig_test, fig_ref):
3075+
x = np.linspace(0, 3.14, 37)
3076+
y = np.sin(x)
3077+
3078+
ax = fig_test.subplots()
3079+
ax.stem(x, y, linefmt='grey', use_line_collection=True)
3080+
3081+
ax = fig_ref.subplots()
3082+
with pytest.warns(UserWarning):
3083+
ax.stem(x, y, linefmt='grey')
3084+
3085+
30733086
def test_stem_args():
30743087
fig = plt.figure()
30753088
ax = fig.add_subplot(1, 1, 1)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.