Skip to content

Commit ecb3c89

Browse files
committed
Remove debugging line, fix _loc_translate, fix colorbar labels bug
1 parent 15ed28f commit ecb3c89

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

proplot/axes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def props(cache):
315315
def _loc_translate(loc, **kwargs):
316316
"""Translates location string `loc` into a standardized form."""
317317
if loc is True:
318-
loc = None
318+
loc = 'r' # for on-the-fly colorbars and legends
319319
elif isinstance(loc, (str, Integral)):
320320
loc = LOC_TRANSLATE.get(loc, loc)
321321
return loc
@@ -3045,7 +3045,6 @@ def format(self, *,
30453045
lonlines = utils.arange(lon_0 - 180, lon_0 + 180, lonlines)
30463046
lonlines = lonlines.astype(np.float64)
30473047
lonlines[-1] -= 1e-10 # make sure appears on *right*
3048-
lonlines = np.arange(-180, 180, 30)
30493048
lonlines = [*lonlines]
30503049

30513050
# Latitudes gridlines, draw from -latmax to latmax unless result

proplot/wrappers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ def standardize_2d(self, func, *args, order='C', globe=False, **kwargs):
497497
y = yi
498498
# Handle figure titles
499499
if self.figure._auto_format:
500+
_, colorbar_label = _auto_label(Zs[0], units=True)
500501
_, title = _auto_label(Zs[0], units=False)
501502
if title:
502503
kw['title'] = title
@@ -646,7 +647,11 @@ def standardize_2d(self, func, *args, order='C', globe=False, **kwargs):
646647
kwargs['latlon'] = False
647648

648649
# Finally return result
649-
return func(self, x, y, *Zs, **kwargs)
650+
# WARNING: Must apply default colorbar label *here* in case metadata
651+
# was stripped by globe=True.
652+
colorbar_kw = kwargs.get('colorbar_kw', None) or {}
653+
colorbar_kw.setdefault('label', colorbar_label)
654+
return func(self, x, y, *Zs, colorbar_kw=colorbar_kw, **kwargs)
650655

651656

652657
def _errorbar_values(data, idata, bardata=None, barrange=None, barstd=False):
@@ -1592,7 +1597,6 @@ def cycle_changer(
15921597
f'Got {ncols} columns in data array, '
15931598
f'but {len(labels)} labels.')
15941599
label = labels[i]
1595-
# _auto_label(iy) # e.g. a pd.Series name
15961600
values, label_leg = _auto_label(iy, axis=1)
15971601
if label_leg and label is None:
15981602
label = _to_array(values)[i]

0 commit comments

Comments
 (0)