391391 with the "¤" dummy character. For details see this `mathtext tutorial \
392392 <https://matplotlib.org/stable/tutorials/text/mathtext.html#custom-fonts>`__.
393393"""
394+ _rc_init_docstring = """
395+ Remaining keyword arguments are passed to `matplotlib.axes.Axes`.
396+ """
394397_rc_format_docstring = """
395398rc_mode : int, optional
396399 The context mode passed to `~proplot.config.Configurator.context`.
397400rc_kw : dict-like, optional
398401 An alternative to passing extra keyword arguments. See below.
399402**kwargs
400- Unknown keyword arguments are passed to `matplotlib.axes.Axes`. Other keyword
401- arguments that match the name of an `~proplot.config.rc` setting are passed to
402- `proplot.config.Configurator.context` and used to update the axes. If the setting
403- name has "dots" you can simply omit the dots. For example, ``abc='A.'`` modifies
404- the :rcraw:`abc` setting, ``titleloc='left'`` modifies the :rcraw:`title.loc`
405- setting, ``gridminor=True`` modifies the :rcraw:`gridminor` setting, and
406- ``gridbelow=True`` modifies the :rcraw:`grid.below` setting. Many of the keyword
407- arguments documented above are internally applied by retrieving settings passed
408- to `~proplot.config.Configurator.context`.
403+ {}Keyword arguments that match the name of an `~proplot.config.rc` setting are
404+ passed to `proplot.config.Configurator.context` and used to update the axes.
405+ If the setting name has "dots" you can simply omit the dots. For example,
406+ ``abc='A.'`` modifies the :rcraw:`abc` setting, ``titleloc='left'`` modifies the
407+ :rcraw:`title.loc` setting, ``gridminor=True`` modifies the :rcraw:`gridminor`
408+ setting, and ``gridbelow=True`` modifies the :rcraw:`grid.below` setting. Many
409+ of the keyword arguments documented above are internally applied by retrieving
410+ settings passed to `~proplot.config.Configurator.context`.
409411"""
410- docstring ._snippet_manager ['axes.rc' ] = _rc_format_docstring
412+ docstring ._snippet_manager ['rc.init' ] = _rc_format_docstring .format (_rc_init_docstring .strip ()) # noqa: E501
413+ docstring ._snippet_manager ['rc.format' ] = _rc_format_docstring .format ('' )
411414docstring ._snippet_manager ['axes.format' ] = _axes_format_docstring
412415docstring ._snippet_manager ['figure.format' ] = _figure_format_docstring
413416
@@ -678,7 +681,7 @@ def __init__(self, *args, **kwargs):
678681
679682 Other parameters
680683 ----------------
681- %(axes.rc )s
684+ %(rc.init )s
682685
683686 See also
684687 --------
@@ -691,18 +694,20 @@ def __init__(self, *args, **kwargs):
691694 proplot.figure.Figure.subplot
692695 proplot.figure.Figure.add_subplot
693696 """
694- # Initialize parent after removing args
695- # NOTE: These are really "subplot" features so documented on add_subplot().
697+ # Remove subplot-related args
698+ # NOTE: These are documented on add_subplot()
696699 ss = kwargs .pop ('_subplot_spec' , None ) # see below
697700 number = kwargs .pop ('number' , None )
698701 autoshare = kwargs .pop ('autoshare' , None )
699702 autoshare = _not_none (autoshare , True )
703+
704+ # Remove format-related args and initialize
700705 rc_kw , rc_mode = _pop_rc (kwargs )
701706 kw_format = _pop_props (kwargs , 'patch' ) # background properties
702- if 'zorder' in kw_format : # special case: refers to entire axes
707+ if 'zorder' in kw_format : # special case: refers to the entire axes
703708 kwargs ['zorder' ] = kw_format .pop ('zorder' )
704- kw_format . update ( _pop_params ( kwargs , self ._format_signature_proj ) )
705- kw_format .update (_pop_params (kwargs , self ._format_signature_base ))
709+ for name in { None , self ._name }: # base method and class method (if it exists )
710+ kw_format .update (_pop_params (kwargs , self ._format_signatures . get ( name ) ))
706711 super ().__init__ (* args , ** kwargs )
707712
708713 # Varous scalar properties
@@ -760,20 +765,18 @@ def __init__(self, *args, **kwargs):
760765 # set_subplotspec. Tried to defer to setter but really messes up both format()
761766 # and _auto_share(). Instead use workaround: Have Figure.add_subplot pass
762767 # subplotspec as a hidden keyword arg. Non-subplots don't need this arg.
763- # See https://github.com/matplotlib/matplotlib/pull/18564
768+ # See: https://github.com/matplotlib/matplotlib/pull/18564
764769 self ._number = None
765770 if number : # not None or False
766- self .number = number # documented in add_subplot
767- if ss is not None :
771+ self .number = number
772+ if ss is not None : # always passed from add_subplot
768773 self .set_subplotspec (ss )
769774 if autoshare :
770775 self ._auto_share ()
771776
772777 # Default formatting
773778 # NOTE: This ignores user-input rc_mode. Mode '1' applies proplot
774779 # features which is necessary on first run. Default otherwise is mode '2'
775- if 'color' in rc_kw :
776- kw_format ['color' ] = rc_kw .pop ('color' ) # special case (argument clash)
777780 self .format (rc_kw = rc_kw , rc_mode = 1 , skip_figure = True , ** kw_format )
778781
779782 @staticmethod
@@ -1431,11 +1434,6 @@ def format(
14311434 ----------
14321435 %(axes.format)s
14331436
1434- Other parameters
1435- ----------------
1436- %(figure.format)s
1437- %(axes.rc)s
1438-
14391437 Important
14401438 ---------
14411439 `abc`, `abcloc`, `titleloc`, `titleabove`, `titlepad`, and
@@ -1444,6 +1442,11 @@ def format(
14441442 change them for specific axes. But many :ref:`other configuration
14451443 settings <ug_format>` can be passed to ``format`` too.
14461444
1445+ Other parameters
1446+ ----------------
1447+ %(figure.format)s
1448+ %(rc.format)s
1449+
14471450 See also
14481451 --------
14491452 proplot.axes.CartesianAxes.format
@@ -3042,8 +3045,8 @@ def number(self, num):
30423045 else :
30433046 raise ValueError (f'Invalid number { num !r} . Must be integer >=1.' )
30443047
3045- # Apply signature obfuscation after getting keys
3046- # NOTE: This is needed for __init__
3047- _format_signature_proj = None
3048- _format_signature_base = inspect .signature (format )
3049- format = docstring ._obfuscate_kwargs (format )
3048+
3049+ # Apply signature obfuscation after storing previous signature
3050+ # NOTE: This is needed for __init__
3051+ Axes . _format_signatures = { None : inspect .signature (Axes . format )}
3052+ Axes . format = docstring ._obfuscate_kwargs (Axes . format )
0 commit comments