@@ -314,7 +314,7 @@ def legend(self, *args, **kwargs):
314314 * args ,
315315 ** kwargs )
316316 if len (extra_args ):
317- raise TypeError ('legend only accepts two non-keyword arguments' )
317+ _api . nargs_error ('legend' , '0-2' , len ( args ) )
318318 self .legend_ = mlegend .Legend (self , handles , labels , ** kwargs )
319319 self .legend_ ._remove_method = self ._remove_legend
320320 return self .legend_
@@ -2970,8 +2970,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
29702970 which inspired this method.
29712971 """
29722972 if not 1 <= len (args ) <= 3 :
2973- raise TypeError ('stem expected between 1 or 3 positional '
2974- f'arguments, got { args } ' )
2973+ _api .nargs_error ('stem' , '1-3' , len (args ))
29752974 _api .check_in_list (['horizontal' , 'vertical' ], orientation = orientation )
29762975
29772976 if len (args ) == 1 :
@@ -6383,7 +6382,7 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
63836382 else :
63846383 raise TypeError ("arguments do not match valid signatures" )
63856384 else :
6386- raise TypeError ( "need 1 argument or 3 arguments" )
6385+ _api . nargs_error ( 'pcolorfast' , '1 or 3' , len ( args ) )
63876386
63886387 if style == "quadmesh" :
63896388 # data point in each cell is value at lower left corner
0 commit comments