Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fbcaec5 commit e7f051fCopy full SHA for e7f051f
1 file changed
lib/matplotlib/tests/test_legend.py
@@ -5,7 +5,7 @@
5
from six.moves import xrange
6
7
import mock
8
-from nose.tools import assert_equal
+from nose.tools import assert_equal, assert_is
9
import numpy as np
10
11
from matplotlib.testing.decorators import image_comparison, cleanup
@@ -113,6 +113,19 @@ def test_legend_expand():
113
ax.legend(loc=3, mode=mode, ncol=2)
114
115
116
+@cleanup
117
+def test_legend_remove():
118
+ fig = plt.figure()
119
+ ax = fig.add_subplot(1, 1, 1)
120
+ lines = ax.plot(range(10))
121
+ leg = fig.legend(lines, "test")
122
+ leg.remove()
123
+ assert_equal(fig.legends, [])
124
+ leg = ax.legend("test")
125
126
+ assert_is(ax.get_legend(), None)
127
+
128
129
class TestLegendFunction(object):
130
# Tests the legend function on the Axes and pyplot.
131
0 commit comments