Skip to content

Commit 3e6e303

Browse files
committed
ENH: Make colorbar axes more typical
1 parent d17905c commit 3e6e303

34 files changed

+893
-1526
lines changed

lib/matplotlib/axes/_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __call__(self, ax, renderer):
113113
# transFigure may otherwise change after this is evaluated.
114114
return mtransforms.TransformedBbox(
115115
mtransforms.Bbox.from_bounds(*self._bounds),
116-
self._transform - ax.figure.transFigure)
116+
self._transform - ax.figure.transSubfigure)
117117

118118

119119
def _process_plot_format(fmt):

lib/matplotlib/colorbar.py

+198-195
Large diffs are not rendered by default.

lib/matplotlib/scale.py

+8
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def __init__(self, axis):
5353
be used: a single scale object should be usable by multiple
5454
`~matplotlib.axis.Axis`\es at the same time.
5555
"""
56+
self._kwargs = dict()
5657

5758
def get_transform(self):
5859
"""
@@ -92,6 +93,7 @@ def __init__(self, axis):
9293
# the docstring of Axis.set_scale.
9394
"""
9495
"""
96+
self.kwargs = dict()
9597

9698
def set_default_locators_and_formatters(self, axis):
9799
# docstring inherited
@@ -173,6 +175,7 @@ def forward(values: array-like) -> array-like
173175
forward, inverse = functions
174176
transform = FuncTransform(forward, inverse)
175177
self._transform = transform
178+
self._kwargs = {'functions': functions}
176179

177180
def get_transform(self):
178181
"""Return the `.FuncTransform` associated with this scale."""
@@ -296,6 +299,7 @@ def __init__(*, base=10, subs=None, nonpositive="clip"):
296299
base, subs, nonpositive = __init__(**kwargs)
297300
self._transform = LogTransform(base, nonpositive)
298301
self.subs = subs
302+
self._kwargs = kwargs
299303

300304
base = property(lambda self: self._transform.base)
301305

@@ -349,6 +353,7 @@ def forward(values: array-like) -> array-like
349353
forward, inverse = functions
350354
self.subs = None
351355
self._transform = FuncTransform(forward, inverse) + LogTransform(base)
356+
self._kwargs = {'functions': functions, 'base': base}
352357

353358
@property
354359
def base(self):
@@ -476,6 +481,7 @@ def __init__(*, base=10, linthresh=2, subs=None, linscale=1):
476481
base, linthresh, subs, linscale = __init__(**kwargs)
477482
self._transform = SymmetricalLogTransform(base, linthresh, linscale)
478483
self.subs = subs
484+
self._kwargs = kwargs
479485

480486
base = property(lambda self: self._transform.base)
481487
linthresh = property(lambda self: self._transform.linthresh)
@@ -569,6 +575,8 @@ def __init__(self, axis, nonpositive='mask', *,
569575
self._transform = LogitTransform(nonpositive)
570576
self._use_overline = use_overline
571577
self._one_half = one_half
578+
self._kwargs = {'nonpositive': nonpositive, 'one_half': one_half,
579+
'use_overline': use_overline}
572580

573581
def get_transform(self):
574582
"""Return the `.LogitTransform` associated with this scale."""

lib/matplotlib/testing/decorators.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def _checked_on_freetype_version(required_freetype_version):
111111
def remove_ticks_and_titles(figure):
112112
figure.suptitle("")
113113
null_formatter = ticker.NullFormatter()
114-
for ax in figure.get_axes():
114+
def remove_ticks(ax):
115115
ax.set_title("")
116116
ax.xaxis.set_major_formatter(null_formatter)
117117
ax.xaxis.set_minor_formatter(null_formatter)
@@ -122,6 +122,11 @@ def remove_ticks_and_titles(figure):
122122
ax.zaxis.set_minor_formatter(null_formatter)
123123
except AttributeError:
124124
pass
125+
for child in ax.child_axes:
126+
remove_ticks(child)
127+
128+
for ax in figure.get_axes():
129+
remove_ticks(ax)
125130

126131

127132
def _raise_on_image_difference(expected, actual, tol):
Binary file not shown.

0 commit comments

Comments
 (0)