Skip to content

Commit cc3a708

Browse files
committed
Add legend to acorr image test
1 parent 72b06a3 commit cc3a708

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@ def xcorr(self, x, y, normed=True, detrend=mlab.detrend_none,
17601760
if usevlines:
17611761
a = self.vlines(lags, [0], correls, **kwargs)
17621762
# Make label empty so only vertical lines get a legend entry
1763-
kwargs['label'] = ''
1763+
kwargs.pop('label', '')
17641764
b = self.axhline(**kwargs)
17651765
else:
17661766
kwargs.setdefault('marker', 'o')
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def test_acorr():
5151
x = np.random.normal(0, 1, n).cumsum()
5252

5353
fig, ax = plt.subplots()
54-
ax.acorr(x, maxlags=n - 1)
54+
ax.acorr(x, maxlags=n - 1, label='acorr')
55+
ax.legend()
5556

5657

5758
@image_comparison(baseline_images=['spy'], extensions=['png'], style='mpl20')

0 commit comments

Comments
 (0)