@@ -2203,20 +2203,6 @@ def has_data(self):
2203
2203
mlines .Line2D , mpatches .Patch ))
2204
2204
for a in self ._children )
2205
2205
2206
- def _deprecate_noninstance (self , _name , _types , ** kwargs ):
2207
- """
2208
- For each *key, value* pair in *kwargs*, check that *value* is an
2209
- instance of one of *_types*; if not, raise an appropriate deprecation.
2210
- """
2211
- for key , value in kwargs .items ():
2212
- if not isinstance (value , _types ):
2213
- _api .warn_deprecated (
2214
- '3.5' , name = _name ,
2215
- message = f'Passing argument *{ key } * of unexpected type '
2216
- f'{ type (value ).__qualname__ } to %(name)s which only '
2217
- f'accepts { _types } is deprecated since %(since)s and will '
2218
- 'become an error %(removal)s.' )
2219
-
2220
2206
def add_artist (self , a ):
2221
2207
"""
2222
2208
Add an `.Artist` to the Axes; return the artist.
@@ -2260,8 +2246,7 @@ def add_collection(self, collection, autolim=True):
2260
2246
"""
2261
2247
Add a `.Collection` to the Axes; return the collection.
2262
2248
"""
2263
- self ._deprecate_noninstance ('add_collection' , mcoll .Collection ,
2264
- collection = collection )
2249
+ _api .check_isinstance (mcoll .Collection , collection = collection )
2265
2250
label = collection .get_label ()
2266
2251
if not label :
2267
2252
collection .set_label (f'_child{ len (self ._children )} ' )
@@ -2294,7 +2279,7 @@ def add_image(self, image):
2294
2279
"""
2295
2280
Add an `.AxesImage` to the Axes; return the image.
2296
2281
"""
2297
- self . _deprecate_noninstance ( 'add_image' , mimage .AxesImage , image = image )
2282
+ _api . check_isinstance ( mimage .AxesImage , image = image )
2298
2283
self ._set_artist_props (image )
2299
2284
if not image .get_label ():
2300
2285
image .set_label (f'_child{ len (self ._children )} ' )
@@ -2311,7 +2296,7 @@ def add_line(self, line):
2311
2296
"""
2312
2297
Add a `.Line2D` to the Axes; return the line.
2313
2298
"""
2314
- self . _deprecate_noninstance ( 'add_line' , mlines .Line2D , line = line )
2299
+ _api . check_isinstance ( mlines .Line2D , line = line )
2315
2300
self ._set_artist_props (line )
2316
2301
if line .get_clip_path () is None :
2317
2302
line .set_clip_path (self .patch )
@@ -2328,7 +2313,7 @@ def _add_text(self, txt):
2328
2313
"""
2329
2314
Add a `.Text` to the Axes; return the text.
2330
2315
"""
2331
- self . _deprecate_noninstance ( '_add_text' , mtext .Text , txt = txt )
2316
+ _api . check_isinstance ( mtext .Text , txt = txt )
2332
2317
self ._set_artist_props (txt )
2333
2318
self ._children .append (txt )
2334
2319
txt ._remove_method = self ._children .remove
@@ -2387,7 +2372,7 @@ def add_patch(self, p):
2387
2372
"""
2388
2373
Add a `.Patch` to the Axes; return the patch.
2389
2374
"""
2390
- self . _deprecate_noninstance ( 'add_patch' , mpatches .Patch , p = p )
2375
+ _api . check_isinstance ( mpatches .Patch , p = p )
2391
2376
self ._set_artist_props (p )
2392
2377
if p .get_clip_path () is None :
2393
2378
p .set_clip_path (self .patch )
@@ -2440,7 +2425,7 @@ def add_table(self, tab):
2440
2425
"""
2441
2426
Add a `.Table` to the Axes; return the table.
2442
2427
"""
2443
- self . _deprecate_noninstance ( 'add_table' , mtable .Table , tab = tab )
2428
+ _api . check_isinstance ( mtable .Table , tab = tab )
2444
2429
self ._set_artist_props (tab )
2445
2430
self ._children .append (tab )
2446
2431
tab .set_clip_path (self .patch )
0 commit comments