Skip to content
Closed
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
5b09d89
Try to pop vmin and vmax out of norm_kw
lukelbd Sep 2, 2019
a3ebbb1
Respect vmin and vmax as hard minimum/maximum
lukelbd Sep 2, 2019
ba2ce6f
Merge branch 'master' into panels-change-gridspec
lukelbd Sep 2, 2019
bad8024
Remove PanelAxes, and remove 'panels' args from subplots()! Colorbar …
lukelbd Sep 3, 2019
aa4cccf
On-the-fly figure colorbars and legends!
lukelbd Sep 3, 2019
c264999
Return axes_grid of panels, fix _panels_kwargs bug
lukelbd Sep 3, 2019
088a537
Fix axes_grid docstring
lukelbd Sep 3, 2019
bf87d3a
Minor
lukelbd Sep 3, 2019
cfe7e66
axes_grid docstring
lukelbd Sep 3, 2019
3205230
Zoom attribute change
lukelbd Sep 3, 2019
00bd9ff
Auto legend cleanup
lukelbd Sep 3, 2019
25934db
Comments
lukelbd Sep 3, 2019
73dd02c
Better 'span' fig panel aliases
lukelbd Sep 3, 2019
9254346
Add AAAS to journals; fix bug in pulling their dims
bradyrx Sep 4, 2019
32c4cc8
Move journal dictionary to top; add testing for journals
bradyrx Sep 4, 2019
7b6e4e0
Misc bugfixes and cleanup
lukelbd Sep 5, 2019
b8df9e1
Panels bugfix
lukelbd Sep 5, 2019
c67c3f8
Remove print statement
lukelbd Sep 5, 2019
5643867
Update documentation to reflect new colorbars, legends usage, add ins…
lukelbd Sep 5, 2019
4a43155
Merge pull request #31 from lukelbd/panels-change-gridspec
lukelbd Sep 5, 2019
acc905c
Remove duplicate 'Plotting wrappers' docs
lukelbd Sep 5, 2019
c2ae600
All caps constants
lukelbd Sep 6, 2019
f9c6eda
Name change fix
lukelbd Sep 6, 2019
c880ef1
Figure documentation
lukelbd Sep 6, 2019
7a611b5
_subplots_geometry cleanup
lukelbd Sep 6, 2019
43943a7
Merge pull request #30 from bradyrx/add_aaas_journals
lukelbd Sep 6, 2019
ddcc5fe
Repair dead links in wrappers.py
lukelbd Sep 6, 2019
bb3f21a
Merge branch 'master' of https://github.com/lukelbd/proplot
lukelbd Sep 6, 2019
039aea3
Demo stacked figure panels
lukelbd Sep 6, 2019
8804efc
_reassign_title bugfix, minor docs changes
lukelbd Sep 9, 2019
2b78889
Preliminary add_subplot changes
lukelbd Sep 9, 2019
695318b
Merge from master
lukelbd Sep 14, 2019
513d3e0
Fix import error
lukelbd Sep 14, 2019
ff760aa
Merge and fix docs conflicts
lukelbd Sep 18, 2019
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
Auto legend cleanup
  • Loading branch information
lukelbd committed Sep 3, 2019
commit 00bd9ffdc3a59f4e6bd77ec5c5e58b4be06b380a
14 changes: 5 additions & 9 deletions proplot/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,8 @@ def __init__(self, *args, number=None,
self._altx_child = None
self._alty_parent = None
self._altx_parent = None
self._auto_colorbar = {} # stores plot handles for auto colorbar
self._auto_colorbar = {} # stores handles and kwargs for auto colorbar
self._auto_legend = {}
self._auto_colorbar_kw = {} # keyword args for auto colorbar()
self._auto_legend_kw = {}
# Axis sharing, new text attributes, custom formatting
self._spanx = spanx # boolean toggles, whether we want to span axes labels
self._spany = spany
Expand Down Expand Up @@ -210,14 +208,12 @@ def _draw_auto_legends_colorbars(self):
"""Generate automatic legends and colorbars. Wrapper funcs
let user add handles to location lists with successive calls to
make successive calls to plotting commands."""
for loc,handles in self._auto_colorbar.items():
self.colorbar(handles, **self._auto_colorbar_kw[loc])
for loc,handles in self._auto_legend.items():
self.legend(handles, **self._auto_legend_kw[loc])
for loc,(handles,kwargs) in self._auto_colorbar.items():
self.colorbar(handles, **kwargs)
for loc,(handles,kwargs) in self._auto_legend.items():
self.legend(handles, **kwargs)
self._auto_legend = {}
self._auto_colorbar = {}
self._auto_legend_kw = {}
self._auto_colorbar_kw = {}

def _get_side_axes(self, side):
"""Returns groups of axes in row or column or the single group in the
Expand Down
14 changes: 6 additions & 8 deletions proplot/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1589,31 +1589,29 @@ def cycle_wrapper(self, func, *args,
if not isinstance(loc, str):
raise ValueError(f'Invalid on-the-fly location {loc!r}. Must be a preset location. See Axes.colorbar')
if loc not in self._auto_colorbar:
self._auto_colorbar[loc] = []
self._auto_colorbar_kw[loc] = {}
self._auto_colorbar[loc].extend(objs)
self._auto_colorbar[loc] = ([], {})
self._auto_colorbar[loc][0].extend(objs)
# Add keywords
if loc != 'fill':
colorbar_kw.setdefault('loc', loc)
if label_leg:
colorbar_kw.setdefault('label', label_leg)
self._auto_colorbar_kw[loc].update(colorbar_kw)
self._auto_colorbar[loc][1].update(colorbar_kw)
if legend:
# Add handles
panel_kw.setdefault('mode', 'legend')
loc = self._loc_translate(legend, **panel_kw)
if not isinstance(loc, str):
raise ValueError(f'Invalid on-the-fly location {loc!r}. Must be a preset location. See Axes.legend')
if loc not in self._auto_legend:
self._auto_legend[loc] = []
self._auto_legend_kw[loc] = {}
self._auto_legend[loc].extend(objs)
self._auto_legend[loc] = ([], {})
self._auto_legend[loc][0].extend(objs)
# Add keywords
if loc != 'fill':
legend_kw.setdefault('loc', loc)
if label_leg:
legend_kw.setdefault('label', label_leg)
self._auto_legend_kw[loc].update(legend_kw)
self._auto_legend[loc][1].update(legend_kw)

# Return
# WARNING: Make sure plot always returns tuple of objects, and bar always
Expand Down