@@ -535,9 +535,20 @@ def add_axes(self, *args, **kwargs):
535535
536536 Call signatures::
537537
538+ add_axes()
538539 add_axes(rect, projection=None, polar=False, **kwargs)
539540 add_axes(ax)
540541
542+ Without parameters a "standard" Axes is created that fills the figure.
543+ ``fig = plt.figure(), ax = fig.add_axes()`` is equivalent to
544+ ``fig, ax = plt.subplots()``.
545+
546+ If a *rect* tuple is passed, a new Axes is created at the given figure
547+ coordinates.
548+
549+ Passing an existing `~.axes.Axes` instance *ax* adds it to the figure.
550+ This is only for rare use cases. See the notes section below.
551+
541552 Parameters
542553 ----------
543554 rect : tuple (left, bottom, width, height)
@@ -613,19 +624,21 @@ def add_axes(self, *args, **kwargs):
613624 fig.delaxes(ax)
614625 fig.add_axes(ax)
615626 """
616-
617- if not len (args ) and 'rect' not in kwargs :
618- raise TypeError ("add_axes() missing 1 required positional argument: 'rect'" )
619- elif 'rect' in kwargs :
627+ if 'rect' in kwargs :
628+ # handle add_axes(rect=[...]) as add_axes([...])
620629 if len (args ):
621630 raise TypeError ("add_axes() got multiple values for argument 'rect'" )
622631 args = (kwargs .pop ('rect' ), )
623- if len (args ) != 1 :
624- raise _api .nargs_error ("add_axes" , 1 , len (args ))
632+
633+ if len (args ) > 1 :
634+ raise _api .nargs_error ("add_axes" , "0 or 1" , len (args ))
635+
636+ if not args :
637+ return self .add_subplot ()
625638
626639 if isinstance (args [0 ], Axes ):
627640 a , = args
628- key = a ._projection_init
641+ key = a ._projection_initxes
629642 if a .get_figure (root = False ) is not self :
630643 raise ValueError (
631644 "The Axes must have been created in the present figure" )
@@ -648,10 +661,10 @@ def add_subplot(self, *args, **kwargs):
648661
649662 Call signatures::
650663
664+ add_subplot()
651665 add_subplot(nrows, ncols, index, **kwargs)
652666 add_subplot(pos, **kwargs)
653667 add_subplot(ax)
654- add_subplot()
655668
656669 Parameters
657670 ----------
0 commit comments