Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3ad9be2

Browse filesBrowse files
authored
Merge pull request #13351 from LevN0/fix-log-colorbar-minorticks-revert-set-ticks
Fix: Log Colorbar minorticks_off reverted if ticks set
2 parents dcba27e + ffaaabd commit 3ad9be2
Copy full SHA for 3ad9be2

File tree

Expand file treeCollapse file tree

2 files changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-2
lines changed

‎lib/matplotlib/colorbar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colorbar.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,8 @@ def _reset_locator_formatter_scale(self):
579579
# mid point is easier.
580580
self.ax.set_xscale('log')
581581
self.ax.set_yscale('log')
582+
583+
self.minorticks_on()
582584
else:
583585
self.ax.set_xscale('linear')
584586
self.ax.set_yscale('linear')
@@ -602,8 +604,6 @@ def update_ticks(self):
602604
_log.debug('locator: %r', locator)
603605
long_axis.set_major_locator(locator)
604606
long_axis.set_major_formatter(formatter)
605-
if type(self.norm) == colors.LogNorm:
606-
self.minorticks_on()
607607
else:
608608
_log.debug('Using fixed locator on colorbar')
609609
ticks, ticklabels, offset_string = self._ticker(locator, formatter)

‎lib/matplotlib/tests/test_colorbar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_colorbar.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ def test_colorbar_minorticks_on_off():
325325
assert np.array_equal(cbar.ax.yaxis.get_minorticklocs(),
326326
default_minorticklocks)
327327

328+
# test issue #13339: minorticks for LogNorm should stay off
329+
cbar.minorticks_off()
330+
cbar.set_ticks([3, 5, 7, 9])
331+
assert np.array_equal(cbar.ax.yaxis.get_minorticklocs(),
332+
np.array([]))
333+
328334

329335
def test_colorbar_autoticks():
330336
# Test new autotick modes. Needs to be classic because

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.