Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Various bugfixes, remove unused w/hflush kwargs
  • Loading branch information
lukelbd committed Jan 7, 2020
commit 804cac70347a330b74d7b34ca9bf4fb9658ed158
8 changes: 4 additions & 4 deletions proplot/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,10 @@ def _range_gridspec(self, x):
raise RuntimeError(f'Axes is not a subplot.')
ss = self.get_subplotspec()
if x == 'x':
_, _, _, _, col1, col2 = ss.get_rows_columns()
_, _, _, _, col1, col2 = ss.get_active_rows_columns()
return col1, col2
else:
_, _, row1, row2, _, _ = ss.get_rows_columns()
_, _, row1, row2, _, _ = ss.get_active_rows_columns()
return row1, row2

def _range_tightbbox(self, x):
Expand Down Expand Up @@ -573,7 +573,7 @@ def _update_axislabels(self, x='x', **kwargs):

# Apply to spanning axes and their panels
axs = [ax]
if getattr(ax, '_span' + x + '_on'):
if getattr(ax.figure, '_span' + x):
s = axis.get_label_position()[0]
if s in 'lb':
axs = ax._get_side_axes(s)
Expand Down Expand Up @@ -1870,7 +1870,7 @@ def _hide_labels(self):
axis = getattr(self, x + 'axis')
share = getattr(self, '_share' + x)
if share is not None:
level = getattr(self, '_share' + x + '_level')
level = getattr(self.figure, '_share' + x)
if level > 0:
axis.label.set_visible(False)
if level > 2:
Expand Down
20 changes: 9 additions & 11 deletions proplot/subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@ def _adjust_tight_layout(self, renderer, resize=True):
bottom = bbox.ymin
right = obox.xmax - bbox.xmax
top = obox.ymax - bbox.ymax

# Apply new bounds, permitting user overrides
# TODO: Account for bounding box NaNs?
for key, offset in zip(
Expand All @@ -1190,9 +1191,11 @@ def _adjust_tight_layout(self, renderer, resize=True):
panelpad = self._panelpad
gridspec = self._gridspec_main
nrows, ncols = gridspec.get_active_geometry()
wspace, hspace = subplots_kw['wspace'], subplots_kw['hspace']
wspace = subplots_kw['wspace']
hspace = subplots_kw['hspace']
wspace_orig = subplots_orig_kw['wspace']
hspace_orig = subplots_orig_kw['hspace']

# Get new subplot spacings, axes panel spacing, figure panel spacing
spaces = []
for (w, x, y, nacross, ispace, ispace_orig) in zip(
Expand Down Expand Up @@ -1256,7 +1259,6 @@ def _adjust_tight_layout(self, renderer, resize=True):
x2 = min(ax._range_tightbbox(x)[0] for ax in group2)
jspaces.append((x2 - x1) / self.dpi)
if jspaces:
# TODO: why max 0?
space = max(0, space - min(jspaces) + pad)
space = _notNone(space_orig, space) # user input overwrite
jspace[i] = space
Expand Down Expand Up @@ -1288,10 +1290,9 @@ def _align_axislabels(self, b=True):
if not isinstance(ax, axes.XYAxes):
continue
for x, axis in zip('xy', (ax.xaxis, ax.yaxis)):
# top or bottom, left or right
s = axis.get_label_position()[0]
span = getattr(ax, '_span' + x + '_on')
align = getattr(ax, '_align' + x + '_on')
span = getattr(self, '_span' + x)
align = getattr(self, '_align' + x)
if s not in 'bl' or axis in tracker:
continue
axs = ax._get_side_axes(s)
Expand Down Expand Up @@ -1336,8 +1337,9 @@ def _align_axislabels(self, b=True):
mtransforms.IdentityTransform(), self.transFigure)
for axis in axises:
axis.label.set_visible((axis is spanaxis))
spanlabel.update(
{'position': position, 'transform': transform})
spanlabel.update({
'position': position, 'transform': transform
})

def _align_labels(self, renderer):
"""Adjusts position of row and column labels, and aligns figure super
Expand Down Expand Up @@ -2046,11 +2048,7 @@ def subplots(
hspace=None, wspace=None, space=None,
hratios=None, wratios=None,
width_ratios=None, height_ratios=None,
flush=None, wflush=None, hflush=None,
left=None, bottom=None, right=None, top=None,
span=None, spanx=None, spany=None,
align=None, alignx=None, aligny=None,
share=None, sharex=None, sharey=None,
basemap=False, proj=None, projection=None,
proj_kw=None, projection_kw=None,
**kwargs
Expand Down