From 5eee0ec10c1219557f2a198233787b156382e459 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 23 May 2016 15:48:00 -0400 Subject: [PATCH] FIX: minimum number of bins in 'auto' is 3 This is to prevent plots with only one visible tick. Use 3 instead of 2 because ticks may fall out of the visible range so 2 bins would be 3 ticks which may be one visible and 2 off either end. --- lib/matplotlib/ticker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index b22ee19ae68c..02603bdb1904 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -1549,7 +1549,7 @@ def set_params(self, **kwargs): def _raw_ticks(self, vmin, vmax): nbins = self._nbins if nbins == 'auto': - nbins = max(min(self.axis.get_tick_space(), 9), 1) + nbins = max(min(self.axis.get_tick_space(), 9), 3) scale, offset = scale_range(vmin, vmax, nbins) if self._integer: scale = max(1, scale)