@@ -2203,20 +2203,6 @@ def has_data(self):
22032203 mlines .Line2D , mpatches .Patch ))
22042204 for a in self ._children )
22052205
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-
22202206 def add_artist (self , a ):
22212207 """
22222208 Add an `.Artist` to the Axes; return the artist.
@@ -2260,8 +2246,7 @@ def add_collection(self, collection, autolim=True):
22602246 """
22612247 Add a `.Collection` to the Axes; return the collection.
22622248 """
2263- self ._deprecate_noninstance ('add_collection' , mcoll .Collection ,
2264- collection = collection )
2249+ _api .check_isinstance (mcoll .Collection , collection = collection )
22652250 label = collection .get_label ()
22662251 if not label :
22672252 collection .set_label (f'_child{ len (self ._children )} ' )
@@ -2294,7 +2279,7 @@ def add_image(self, image):
22942279 """
22952280 Add an `.AxesImage` to the Axes; return the image.
22962281 """
2297- self . _deprecate_noninstance ( 'add_image' , mimage .AxesImage , image = image )
2282+ _api . check_isinstance ( mimage .AxesImage , image = image )
22982283 self ._set_artist_props (image )
22992284 if not image .get_label ():
23002285 image .set_label (f'_child{ len (self ._children )} ' )
@@ -2311,7 +2296,7 @@ def add_line(self, line):
23112296 """
23122297 Add a `.Line2D` to the Axes; return the line.
23132298 """
2314- self . _deprecate_noninstance ( 'add_line' , mlines .Line2D , line = line )
2299+ _api . check_isinstance ( mlines .Line2D , line = line )
23152300 self ._set_artist_props (line )
23162301 if line .get_clip_path () is None :
23172302 line .set_clip_path (self .patch )
@@ -2328,7 +2313,7 @@ def _add_text(self, txt):
23282313 """
23292314 Add a `.Text` to the Axes; return the text.
23302315 """
2331- self . _deprecate_noninstance ( '_add_text' , mtext .Text , txt = txt )
2316+ _api . check_isinstance ( mtext .Text , txt = txt )
23322317 self ._set_artist_props (txt )
23332318 self ._children .append (txt )
23342319 txt ._remove_method = self ._children .remove
@@ -2387,7 +2372,7 @@ def add_patch(self, p):
23872372 """
23882373 Add a `.Patch` to the Axes; return the patch.
23892374 """
2390- self . _deprecate_noninstance ( 'add_patch' , mpatches .Patch , p = p )
2375+ _api . check_isinstance ( mpatches .Patch , p = p )
23912376 self ._set_artist_props (p )
23922377 if p .get_clip_path () is None :
23932378 p .set_clip_path (self .patch )
@@ -2440,7 +2425,7 @@ def add_table(self, tab):
24402425 """
24412426 Add a `.Table` to the Axes; return the table.
24422427 """
2443- self . _deprecate_noninstance ( 'add_table' , mtable .Table , tab = tab )
2428+ _api . check_isinstance ( mtable .Table , tab = tab )
24442429 self ._set_artist_props (tab )
24452430 self ._children .append (tab )
24462431 tab .set_clip_path (self .patch )
0 commit comments