Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b9667cf
Initial commit
lukelbd Dec 19, 2019
83ef32c
Merge branch 'master' into rc-cleanup-fixes
lukelbd Jan 6, 2020
e464a99
Move default props from .proplotrc --> rctools.py
lukelbd Jan 6, 2020
e760807
Improve rc_configurator getitem/setitem, add helper func
lukelbd Jan 6, 2020
d6b6020
Update get(), fill(), category(); add dict() and iterator methods
lukelbd Jan 6, 2020
a82dd68
Fix rc_configurator.context() bug
lukelbd Jan 6, 2020
dea6d94
Improve iter, contains, and string repr methods
lukelbd Jan 6, 2020
44a4bc9
Improve _loc_translate + _get_title_props, related cleanup
lukelbd Jan 7, 2020
424bc67
Remove Axes.context, update rc lookups, related cleanup
lukelbd Jan 7, 2020
8e7655e
Add x/ylinewidth, x/ygridcolor XYAxes.format kwargs
lukelbd Jan 7, 2020
25f7bd8
Fix rc lookups in other files
lukelbd Jan 7, 2020
77e406a
Remove Axes.context, add documented Axes.number prop
lukelbd Jan 7, 2020
61a45d4
Update changelog and index
lukelbd Jan 7, 2020
93c8aa5
Cleaner install instructions
lukelbd Jan 7, 2020
da123eb
Remove rc._init reference
lukelbd Jan 7, 2020
5b45522
Fix bug/conflict between ipython_* funcs and rc.__init__
lukelbd Jan 7, 2020
1bf78ce
Remove _getitem_mode assignment
lukelbd Jan 7, 2020
3c44865
Add _get_space function, simplify _panel_kwargs function
lukelbd Jan 7, 2020
3fb9a52
Rename _panel_kwargs --> _get_panelargs
lukelbd Jan 7, 2020
dba9f70
Use _get_space; remove refs to subplots.ylabspace, etc.
lukelbd Jan 7, 2020
fdfe042
Update default font sizes
lukelbd Jan 7, 2020
3218c2a
Change refs from panelspace --> panelpad
lukelbd Jan 7, 2020
1ab92ca
Remove subplots.ylabspace, etc. from configuration docs
lukelbd Jan 7, 2020
16ae44f
Fix _loc_translate bug
lukelbd Jan 7, 2020
6629efb
Remove panel_kw from colorbar/legend_wrapper
lukelbd Jan 7, 2020
ef33694
Update changelog
lukelbd Jan 7, 2020
20b9f5b
No longer change figure.dpi
lukelbd Jan 7, 2020
db78bc0
Fix rc.category bug, minor subplots bugs
lukelbd Jan 7, 2020
c57c7b0
Prefer closing brackets on new lines
lukelbd Jan 7, 2020
578aa8b
Better install instructions
lukelbd Jan 7, 2020
7acffb6
Update changelog
lukelbd Jan 7, 2020
8da19f5
Remove outdated cache=False ref, remove debug statement
lukelbd Jan 7, 2020
3ca9a02
Minor BasemapAxes bugfix
lukelbd Jan 7, 2020
22af8f9
Notebook examples formatting improvements
lukelbd Jan 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix rc.category bug, minor subplots bugs
  • Loading branch information
lukelbd committed Jan 7, 2020
commit db78bc046493973684be2f3762ab4ec8b732827d
14 changes: 10 additions & 4 deletions proplot/rctools.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,15 +851,18 @@ def _get_item(self, key, mode=None):
else:
return None

def category(self, cat, *, context=False):
def category(self, cat, *, trimcat=True, context=False):
"""
Return a dictionary of settings beginning with the substring
``cat + '.'``.

Parameters
----------
cat : str, optional
The `rc` settings category.
The `rc` setting category.
trimcat : bool, optional
Whether to trim ``cat`` from the key names in the output
dictionary. Default is ``True``.
context : bool, optional
If ``True``, then each category setting that is not found in the
context mode dictionaries is omitted from the output dictionary.
Expand All @@ -868,16 +871,19 @@ def category(self, cat, *, context=False):
if cat not in RC_CATEGORIES:
raise ValueError(
f'Invalid rc category {cat!r}. Valid categories are '
', '.join(map(repr, RC_CATEGORIES)) + '.')
', '.join(map(repr, RC_CATEGORIES)) + '.'
)
kw = {}
mode = 0 if not context else None
for rcdict in (rcParamsLong, rcParams):
for key in rcdict:
if not re.search(f'^{cat}[.][^.]+$', key):
if not re.match(fr'\A{cat}\.[^.]+\Z', key):
continue
value = self._get_item(key, mode)
if value is None:
continue
if trimcat:
key = re.sub(fr'\A{cat}\.', '', key)
kw[key] = value
return kw

Expand Down
5 changes: 3 additions & 2 deletions proplot/subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def _get_panelargs(
width = units(width)
if space is None:
key = ('wspace' if s in 'lr' else 'hspace')
pad = (rc['axpad'] if figure else rc['panelpad'])
pad = (rc['subplots.axpad'] if figure else rc['subplots.panelpad'])
space = _get_space(key, share, pad=pad)
return share, width, space, space_user

Expand Down Expand Up @@ -2192,10 +2192,11 @@ def subplots(
right = _notNone(right, _get_space('right'))
bottom = _notNone(bottom, _get_space('bottom'))
top = _notNone(top, _get_space('top'))
wratios, hratios = [*wratios], [*hratios] # copies
wspace, hspace = np.array(wspace), np.array(hspace) # also copies!
wspace[wspace == None] = _get_space('wspace', sharex) # noqa
hspace[hspace == None] = _get_space('hspace', sharey) # noqa
wratios, hratios = list(wratios), list(hratios)
wspace, hspace = list(wspace), list(hspace)

# Parse arguments, fix dimensions in light of desired aspect ratio
figsize, gridspec_kw, subplots_kw = _subplots_geometry(
Expand Down