Skip to content

Commit 221eee0

Browse files
committed
Rename _hide_labels to _apply_axis_sharing
1 parent 07dc8b6 commit 221eee0

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

proplot/axes/cartesian.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,28 @@ def _alty_overrides(self):
262262
self.xaxis.set_visible(False)
263263
self.patch.set_visible(False)
264264

265+
def _apply_axis_sharing(self):
266+
"""
267+
Enforce the "shared" axis labels and axis tick labels. If this is
268+
not called at drawtime, "shared" labels can be inadvertantly turned
269+
off e.g. when the axis scale is changed.
270+
"""
271+
for x in 'xy':
272+
# "Shared" axis and tick labels
273+
axis = getattr(self, x + 'axis')
274+
share = getattr(self, '_share' + x)
275+
if share is not None:
276+
level = (
277+
3 if getattr(self, '_share' + x + '_override')
278+
else getattr(self.figure, '_share' + x)
279+
)
280+
if level > 0:
281+
axis.label.set_visible(False)
282+
if level > 2:
283+
axis.set_major_formatter(mticker.NullFormatter())
284+
# Enforce no minor ticks labels. TODO: Document?
285+
axis.set_minor_formatter(mticker.NullFormatter())
286+
265287
def _datex_rotate(self):
266288
"""
267289
Apply default rotation to datetime axis coordinates.
@@ -335,28 +357,6 @@ def _dualy_overrides(self):
335357
child.set_ylim(nlim, emit=False)
336358
self._dualy_cache = (scale, *olim)
337359

338-
def _hide_labels(self):
339-
"""
340-
Enforce the "shared" axis labels and axis tick labels. If this is
341-
not called at drawtime, "shared" labels can be inadvertantly turned
342-
off e.g. when the axis scale is changed.
343-
"""
344-
for x in 'xy':
345-
# "Shared" axis and tick labels
346-
axis = getattr(self, x + 'axis')
347-
share = getattr(self, '_share' + x)
348-
if share is not None:
349-
level = (
350-
3 if getattr(self, '_share' + x + '_override')
351-
else getattr(self.figure, '_share' + x)
352-
)
353-
if level > 0:
354-
axis.label.set_visible(False)
355-
if level > 2:
356-
axis.set_major_formatter(mticker.NullFormatter())
357-
# Enforce no minor ticks labels. TODO: Document?
358-
axis.set_minor_formatter(mticker.NullFormatter())
359-
360360
def _make_twin_axes(self, *args, **kwargs):
361361
"""
362362
Return a twin of this axes. This is used for twinx and twiny and was
@@ -1185,7 +1185,7 @@ def draw(self, renderer=None, *args, **kwargs):
11851185
# Perform extra post-processing steps
11861186
# NOTE: This mimics matplotlib API, which calls identical
11871187
# post-processing steps in both draw() and get_tightbbox()
1188-
self._hide_labels()
1188+
self._apply_axis_sharing()
11891189
self._altx_overrides()
11901190
self._alty_overrides()
11911191
self._dualx_overrides()
@@ -1197,7 +1197,7 @@ def draw(self, renderer=None, *args, **kwargs):
11971197

11981198
def get_tightbbox(self, renderer, *args, **kwargs):
11991199
# Perform extra post-processing steps
1200-
self._hide_labels()
1200+
self._apply_axis_sharing()
12011201
self._altx_overrides()
12021202
self._alty_overrides()
12031203
self._dualx_overrides()

proplot/axes/geo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ def _add_gridline_label(self, value, axis, upper_end):
711711
self.background_patch.update(kw_face)
712712
self.outline_patch.update(kw_edge)
713713

714-
def _hide_labels(self):
714+
def _apply_axis_sharing(self):
715715
"""
716716
No-op for now. In future this will hide meridian and parallel
717717
labels for rectangular projections with axis sharing.
@@ -721,7 +721,7 @@ def _hide_labels(self):
721721
def get_tightbbox(self, renderer, *args, **kwargs):
722722
# Perform extra post-processing steps
723723
# For now this just draws the gridliners
724-
self._hide_labels()
724+
self._apply_axis_sharing()
725725
if self.get_autoscale_on() and self.ignore_existing_data_limits:
726726
self.autoscale_view()
727727
if (

0 commit comments

Comments
 (0)