Skip to content

Commit dcbf9d5

Browse files
committed
Update rc docs, cleanup
1 parent c4f2030 commit dcbf9d5

File tree

2 files changed

+35
-22
lines changed

2 files changed

+35
-22
lines changed

proplot/config.py

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def register_colors(*args, user=None, default=False, space=None, margin=None, **
585585
@docstring._snippet_manager
586586
def register_fonts(*args, user=True, default=False):
587587
"""
588-
Register font names.
588+
Register font families. This is called on import.
589589
590590
Parameters
591591
----------
@@ -719,7 +719,8 @@ def __init__(self, local=True, user=True, default=True, **kwargs):
719719

720720
def __getitem__(self, key):
721721
"""
722-
Return an `rc_matplotlib` or `rc_proplot` setting.
722+
Return an `rc_matplotlib` or `rc_proplot` setting using dictionary notation
723+
(e.g., ``value = pplt.rc[name]``).
723724
"""
724725
key = self._validate_key(key) # might issue proplot removed/renamed error
725726
try:
@@ -730,15 +731,17 @@ def __getitem__(self, key):
730731

731732
def __setitem__(self, key, value):
732733
"""
733-
Modify an `rc_matplotlib` or `rc_proplot` setting.
734+
Modify an `rc_matplotlib` or `rc_proplot` setting using dictionary notation
735+
(e.g., ``pplt.rc[name] = value``).
734736
"""
735737
kw_proplot, kw_matplotlib = self._get_params(key, value)
736738
rc_proplot.update(kw_proplot)
737739
rc_matplotlib.update(kw_matplotlib)
738740

739741
def __getattr__(self, attr):
740742
"""
741-
Return an `rc_matplotlib` or `rc_proplot` setting.
743+
Return an `rc_matplotlib` or `rc_proplot` setting using "dot" notation
744+
(e.g., ``value = pplt.rc.name``).
742745
"""
743746
if attr[:1] == '_':
744747
return super().__getattribute__(attr) # raise built-in error
@@ -747,7 +750,8 @@ def __getattr__(self, attr):
747750

748751
def __setattr__(self, attr, value):
749752
"""
750-
Modify an `rc_matplotlib` or `rc_proplot` setting.
753+
Modify an `rc_matplotlib` or `rc_proplot` setting using "dot" notation
754+
(e.g., ``pplt.rc.name = value``).
751755
"""
752756
if attr[:1] == '_':
753757
super().__setattr__(attr, value)
@@ -1127,16 +1131,20 @@ def context(self, *args, mode=0, file=None, **kwargs):
11271131
11281132
The options are as follows:
11291133
1130-
0. Matplotlib's `rc_matplotlib` settings and proplots `rc_proplot`
1131-
settings are all returned, whether or not `~Configurator.context`
1132-
has changed them.
1133-
1. Unchanged `rc_matplotlib` settings return ``None`` but `rc_proplot`
1134-
settings are returned whether or not `~Configurator.context` has
1135-
changed them. This is used in the `~proplot.axes.Axes.__init__` call
1136-
to `~proplot.axes.Axes.format`. When a lookup returns ``None``,
1137-
`~proplot.axes.Axes.format` does not apply it.
1138-
2. All unchanged settings return ``None``. This is used during
1139-
user calls to `~proplot.axes.Axes.format`.
1134+
* ``mode=0``: Matplotlib's `rc_matplotlib` settings
1135+
and proplot's `rc_proplot` settings are all returned,
1136+
whether they are local to the "with as" block.
1137+
* ``mode=1``: Matplotlib's `rc_matplotlib` settings are only
1138+
returned if they are local to the "with as" block. For example,
1139+
if :rcraw:`axes.titlesize` was passed to `~Configurator.context`,
1140+
then ``pplt.rc.find('axes.titlesize', context=True)`` will return
1141+
this value, but ``pplt.rc.find('axes.titleweight', context=True)``
1142+
will return ``None``. This is used internally when
1143+
`~proplot.axes.Axes.format` is called during axes instantiation.
1144+
* ``mode=2``: Matplotlib's `rc_matplotlib` settings and proplot's
1145+
`rc_proplot` settings are only returned if they are local to the
1146+
"with as" block. This is used internally when
1147+
`~proplot.axes.Axes.format` is manually called by users.
11401148
11411149
Note
11421150
----
@@ -1280,7 +1288,7 @@ def update(self, *args, **kwargs):
12801288
settings are prepended with ``'category.'``. For example,
12811289
``rc.update('axes', labelsize=20, titlesize=20)`` changes the
12821290
:rcraw:`axes.labelsize` and :rcraw:`axes.titlesize` settings.
1283-
**kwargs, optional
1291+
**kwargs
12841292
`rc` keys and values passed as keyword arguments.
12851293
If the name has dots, simply omit them.
12861294
@@ -1441,8 +1449,8 @@ def save(self, path=None, user=True, comment=None, backup=True, description=Fals
14411449
The path. The default file name is ``proplotrc`` and the default
14421450
directory is the current directory.
14431451
user : bool, optional
1444-
If ``True`` (the default), the settings you changed since importing
1445-
proplot are shown uncommented at the very top of the file.
1452+
If ``True`` (the default), the settings that have `~Configurator.changed`
1453+
from the proplot defaults are shown uncommented at the top of the file.
14461454
backup : bool, optional
14471455
If the file already exists and this is set to ``True``, it is moved
14481456
to a backup file with the suffix ``.bak``.
@@ -1456,6 +1464,7 @@ def save(self, path=None, user=True, comment=None, backup=True, description=Fals
14561464
See also
14571465
--------
14581466
Configurator.load
1467+
Configurator.changed
14591468
"""
14601469
path = os.path.expanduser(path or '.')
14611470
if os.path.isdir(path): # includes ''
@@ -1478,7 +1487,11 @@ def _context_mode(self):
14781487
@property
14791488
def changed(self):
14801489
"""
1481-
A dictionary of settings that have been changed from the proplot defaults.
1490+
A dictionary of settings that have changed from the proplot defaults.
1491+
1492+
See also
1493+
--------
1494+
Configurator.save
14821495
"""
14831496
# Carefully detect changed settings
14841497
rcdict = {}

proplot/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def shift_hue(color, shift=0, space='hcl'):
300300
Parameters
301301
----------
302302
%(utils.color)s
303-
shift : float, optoinal
303+
shift : float, optional
304304
The HCL hue channel is offset by this value.
305305
%(utils.space)s
306306
@@ -333,7 +333,7 @@ def scale_saturation(color, scale=1, space='hcl'):
333333
Parameters
334334
----------
335335
%(utils.color)s
336-
scale : float, optoinal
336+
scale : float, optional
337337
The HCL saturation channel is multiplied by this value.
338338
%(utils.space)s
339339
@@ -365,7 +365,7 @@ def scale_luminance(color, scale=1, space='hcl'):
365365
Parameters
366366
----------
367367
%(utils.color)s
368-
scale : float, optoinal
368+
scale : float, optional
369369
The luminance channel is multiplied by this value.
370370
%(utils.space)s
371371

0 commit comments

Comments
 (0)