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

Skip to content

Commit 0365455

Browse files
committed
use rc_context, thanks @timhoffm for the tip
1 parent 7997f4d commit 0365455

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

lib/matplotlib/tests/test_legend.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,8 @@ def test_warn_big_data_best_loc():
569569
fig, ax = plt.subplots()
570570
ax.plot(np.arange(200001), label='Is this big data?')
571571
with pytest.warns(UserWarning) as records:
572-
l = ax.legend()
573-
# We need to call an internal set method tricking it into thinking
574-
# 'best' location was default.
575-
l._set_loc(l.codes['best'], is_initial_setting=True)
572+
with rc_context({'legend.loc': 'best'}):
573+
l = ax.legend()
576574
fig.canvas.draw()
577575
# The _find_best_position method of Legend is called twice, duplicating
578576
# the warning message.

0 commit comments

Comments
 (0)