diff --git a/holoviews/plotting/mpl/chart.py b/holoviews/plotting/mpl/chart.py index 03e5750ed6..58782852c0 100644 --- a/holoviews/plotting/mpl/chart.py +++ b/holoviews/plotting/mpl/chart.py @@ -333,8 +333,8 @@ def initialize_plot(self, ranges=None): # Get plot ranges and values dims = hist.dimensions()[:2] - edges, hvals, widths, lims, isdatetime = self._process_hist(hist) - if isdatetime and not dims[0].value_format: + edges, hvals, widths, lims, is_datetime = self._process_hist(hist) + if is_datetime and not dims[0].value_format: dt_format = Dimension.type_formatters[np.datetime64] dims[0] = dims[0](value_format=DateFormatter(dt_format)) @@ -381,14 +381,13 @@ def _process_hist(self, hist): hist_vals = np.array(values) xlim = hist.range(0) ylim = hist.range(1) - isdatetime = False - if isdatetime(edges): + is_datetime = isdatetime(edges) + if is_datetime: edges = np.array([dt64_to_dt(e) if isinstance(e, np.datetime64) else e for e in edges]) edges = date2num(edges) xlim = tuple(dt_to_int(v, 'D') for v in xlim) - isdatetime = True widths = np.diff(edges) - return edges[:-1], hist_vals, widths, xlim+ylim, isdatetime + return edges[:-1], hist_vals, widths, xlim+ylim, is_datetime def _compute_ticks(self, element, edges, widths, lims):