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

Skip to content

Commit 8e070e8

Browse files
committed
FIX: fix symlognorm
1 parent d52abb8 commit 8e070e8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/matplotlib/colorbar.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ def _trim_ticks(self, ticks):
235235
return ticks
236236
vmin = self._colorbar.norm.vmin
237237
vmax = self._colorbar.norm.vmax
238-
trans = self._colorbar.norm._scale._transform.transform
238+
if hasattr(self._colorbar.norm, '_scale'):
239+
trans = self._colorbar.norm._scale._transform.transform
240+
else:
241+
trans = mtransforms.IdentityTransform().transform
239242
rtol = (trans(vmax) - trans(vmin)) * 1e-10
240243
good = ((trans(ticks) >= trans(vmin) - rtol) &
241244
(trans(ticks) <= trans(vmax) + rtol))
@@ -607,7 +610,8 @@ def update_ticks(self):
607610
_log.debug('Using auto colorbar locator %r on colorbar',
608611
self.locator)
609612
self._long_axis().set_major_locator(self.locator)
610-
self._long_axis().set_minor_locator(self.minorlocator)
613+
if self.minorlocator is not None:
614+
self._long_axis().set_minor_locator(self.minorlocator)
611615
self._long_axis().set_major_formatter(self.formatter)
612616
else:
613617
_log.debug('Using fixed locator on colorbar')

lib/matplotlib/tests/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ def test_image_preserve_size2():
786786
np.identity(n, bool)[::-1])
787787

788788

789-
@image_comparison(['mask_image_over_under.png'], remove_text=True, tol=1.0)
789+
@image_comparison(['mask_image_over_under.png'], remove_text=False, tol=1.0)
790790
def test_mask_image_over_under():
791791
# Remove this line when this test image is regenerated.
792792
plt.rcParams['pcolormesh.snap'] = False

0 commit comments

Comments
 (0)