Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e4e95d

Browse files
committed
ENH: add long_axis property to colorbar
TST: check long axis correct
1 parent 61995ee commit 1e4e95d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/matplotlib/colorbar.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ def __init__(self, ax, mappable=None, *, cmap=None,
430430
self._extend_cid2 = self.ax.callbacks.connect(
431431
"ylim_changed", self._do_extends)
432432

433+
@property
434+
def long_axis(self):
435+
"""Axis that has decorations (ticks etc) on it."""
436+
return self._long_axis()
437+
433438
@property
434439
def locator(self):
435440
"""Major tick `.Locator` for the colorbar."""

lib/matplotlib/tests/test_colorbar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,7 @@ def test_colorbar_set_formatter_locator():
11391139
fmt = LogFormatter()
11401140
cb.minorformatter = fmt
11411141
assert cb.ax.yaxis.get_minor_formatter() is fmt
1142+
assert cb.long_axis is cb.ax.yaxis
11421143

11431144

11441145
@image_comparison(['colorbar_extend_alpha.png'], remove_text=True,

0 commit comments

Comments
 (0)