@@ -442,26 +442,11 @@ def _get_new_axes(self, *, axes_class=None, **kwargs):
442442
443443 def new_horizontal (self , size , pad = None , pack_start = False , ** kwargs ):
444444 """
445- Add a new axes on the right (or left) side of the main axes .
445+ Helper method for ``append_axes(" left")`` and ``append_axes("right")`` .
446446
447- Parameters
448- ----------
449- size : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
450- The axes width. float or str arguments are interpreted as
451- ``axes_size.from_any(size, AxesX(<main_axes>))``.
452- pad : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
453- Padding between the axes. float or str arguments are interpreted
454- as ``axes_size.from_any(size, AxesX(<main_axes>))``. Defaults to
455- :rc:`figure.subplot.wspace` times the main axes width.
456- pack_start : bool
457- If False, the new axes is appended at the end
458- of the list, i.e., it became the right-most axes. If True, it is
459- inserted at the start of the list, and becomes the left-most axes.
460- **kwargs
461- All extra keywords arguments are passed to the created axes.
462- If *axes_class* is given, the new axes will be created as an
463- instance of the given class. Otherwise, the same class of the
464- main axes will be used.
447+ See the documentation of `append_axes` for more details.
448+
449+ :meta private:
465450 """
466451 if pad is None :
467452 pad = mpl .rcParams ["figure.subplot.wspace" ] * self ._xref
@@ -489,26 +474,11 @@ def new_horizontal(self, size, pad=None, pack_start=False, **kwargs):
489474
490475 def new_vertical (self , size , pad = None , pack_start = False , ** kwargs ):
491476 """
492- Add a new axes on the top (or bottom) side of the main axes .
477+ Helper method for ``append_axes(" top")`` and ``append_axes(" bottom")`` .
493478
494- Parameters
495- ----------
496- size : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
497- The axes height. float or str arguments are interpreted as
498- ``axes_size.from_any(size, AxesY(<main_axes>))``.
499- pad : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
500- Padding between the axes. float or str arguments are interpreted
501- as ``axes_size.from_any(size, AxesY(<main_axes>))``. Defaults to
502- :rc:`figure.subplot.hspace` times the main axes height.
503- pack_start : bool
504- If False, the new axes is appended at the end
505- of the list, i.e., it became the right-most axes. If True, it is
506- inserted at the start of the list, and becomes the left-most axes.
507- **kwargs
508- All extra keywords arguments are passed to the created axes.
509- If *axes_class* is given, the new axes will be created as an
510- instance of the given class. Otherwise, the same class of the
511- main axes will be used.
479+ See the documentation of `append_axes` for more details.
480+
481+ :meta private:
512482 """
513483 if pad is None :
514484 pad = mpl .rcParams ["figure.subplot.hspace" ] * self ._yref
@@ -529,31 +499,47 @@ def new_vertical(self, size, pad=None, pack_start=False, **kwargs):
529499 else :
530500 self ._vertical .append (size )
531501 locator = self .new_locator (
532- nx = self ._xrefindex , ny = len (self ._vertical )- 1 )
502+ nx = self ._xrefindex , ny = len (self ._vertical ) - 1 )
533503 ax = self ._get_new_axes (** kwargs )
534504 ax .set_axes_locator (locator )
535505 return ax
536506
537507 @_api .delete_parameter ("3.5" , "add_to_figure" , alternative = "ax.remove()" )
538- def append_axes (self , position , size , pad = None , add_to_figure = True ,
539- ** kwargs ):
508+ def append_axes (self , position , size , pad = None , add_to_figure = True , * ,
509+ axes_class = None , ** kwargs ):
540510 """
541- Create an axes at the given *position* with the same height
542- (or width) of the main axes.
543-
544- *position*
545- ["left"|"right"|"bottom"|"top"]
511+ Add a new axes on a given side of the main axes.
546512
547- *size* and *pad* should be axes_grid.axes_size compatible.
513+ Parameters
514+ ----------
515+ position : {"left", "right", "bottom", "top"}
516+ Where the new axes is positioned relative to the main axes.
517+ size : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
518+ The axes width or height. float or str arguments are interpreted
519+ as ``axes_size.from_any(size, AxesX(<main_axes>))`` for left or
520+ right axes, and likewise with ``AxesY`` for bottom or top axes.
521+ pad : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
522+ Padding between the axes. float or str arguments are interpreted
523+ as for *size*. Defaults to :rc:`figure.subplot.wspace` times the
524+ main axes width (left or right axes) or :rc:`figure.subplot.hspace`
525+ times the main axes height (bottom or top axes).
526+ axes_class : subclass type of `~.axes.Axes`, optional
527+ The type of the new axes. Defaults to the type of the main axes.
528+ **kwargs
529+ All extra keywords arguments are passed to the created axes.
548530 """
549531 if position == "left" :
550- ax = self .new_horizontal (size , pad , pack_start = True , ** kwargs )
532+ ax = self .new_horizontal (
533+ size , pad , pack_start = True , axes_class = axes_class , ** kwargs )
551534 elif position == "right" :
552- ax = self .new_horizontal (size , pad , pack_start = False , ** kwargs )
535+ ax = self .new_horizontal (
536+ size , pad , pack_start = False , axes_class = axes_class , ** kwargs )
553537 elif position == "bottom" :
554- ax = self .new_vertical (size , pad , pack_start = True , ** kwargs )
538+ ax = self .new_vertical (
539+ size , pad , pack_start = True , axes_class = axes_class , ** kwargs )
555540 elif position == "top" :
556- ax = self .new_vertical (size , pad , pack_start = False , ** kwargs )
541+ ax = self .new_vertical (
542+ size , pad , pack_start = False , axes_class = axes_class , ** kwargs )
557543 else :
558544 _api .check_in_list (["left" , "right" , "bottom" , "top" ],
559545 position = position )
0 commit comments