From 6b506b7dbc23579b977404c4a311070f3a3c537a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Fri, 29 Sep 2023 12:50:06 +0200 Subject: [PATCH] Reverts changes I can't recreate --- holoviews/plotting/bokeh/annotation.py | 7 ++----- holoviews/plotting/bokeh/element.py | 2 +- holoviews/plotting/bokeh/plot.py | 2 +- holoviews/plotting/mpl/annotation.py | 7 ++----- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/holoviews/plotting/bokeh/annotation.py b/holoviews/plotting/bokeh/annotation.py index 6c77964564..1bef23a4c1 100644 --- a/holoviews/plotting/bokeh/annotation.py +++ b/holoviews/plotting/bokeh/annotation.py @@ -4,7 +4,6 @@ import param import numpy as np -import pandas as pd from bokeh.models import BoxAnnotation, Span, Arrow, Slope from panel.models import HTML @@ -69,11 +68,9 @@ def get_extents(self, element, ranges=None, range_type='combined', **kwargs): elif isinstance(element, VLines): extents = extents[0], np.nan, extents[2], np.nan elif isinstance(element, HSpans): - extents = pd.array(extents) # Handle both nan and None - extents = np.nan, extents[:2].min(), np.nan, extents[2:].max() + extents = np.nan, min(extents[:2]), np.nan, max(extents[2:]) elif isinstance(element, VSpans): - extents = pd.array(extents) # Handle both nan and None - extents = extents[:2].min(), np.nan, extents[2:].max(), np.nan + extents = min(extents[:2]), np.nan, max(extents[2:]), np.nan return extents class HLinesAnnotationPlot(_SyntheticAnnotationPlot): diff --git a/holoviews/plotting/bokeh/element.py b/holoviews/plotting/bokeh/element.py index 51696e24b8..c1d20faa20 100644 --- a/holoviews/plotting/bokeh/element.py +++ b/holoviews/plotting/bokeh/element.py @@ -1767,7 +1767,7 @@ def _postprocess_hover(self, renderer, source): for k, values in source.data.items(): key = '@{%s}' % k if ((isinstance(value, np.ndarray) and value.dtype.kind == 'M') or - (len(values) and isinstance(next(iter(values)), util.datetime_types))): + (len(values) and isinstance(values[0], util.datetime_types))): hover.tooltips = [(l, f+'{%F %T}' if f == key else f) for l, f in hover.tooltips] hover.formatters[key] = "datetime" diff --git a/holoviews/plotting/bokeh/plot.py b/holoviews/plotting/bokeh/plot.py index d6cb0c18f3..5ed81c0d86 100644 --- a/holoviews/plotting/bokeh/plot.py +++ b/holoviews/plotting/bokeh/plot.py @@ -131,7 +131,7 @@ def _postprocess_data(self, data): values = decode_bytes(values) # Bytes need decoding to strings # Certain datetime types need to be converted - if len(values) and isinstance(next(iter(values)), cftime_types): + if len(values) and isinstance(values[0], cftime_types): if any(v.calendar not in _STANDARD_CALENDARS for v in values): self.param.warning( 'Converting cftime.datetime from a non-standard ' diff --git a/holoviews/plotting/mpl/annotation.py b/holoviews/plotting/mpl/annotation.py index 5a88c3ce12..1466c56b1e 100644 --- a/holoviews/plotting/mpl/annotation.py +++ b/holoviews/plotting/mpl/annotation.py @@ -1,7 +1,6 @@ import param import numpy as np import matplotlib as mpl -import pandas as pd from matplotlib import patches from matplotlib.lines import Line2D @@ -313,11 +312,9 @@ def get_extents(self, element, ranges=None, range_type='combined', **kwargs): elif isinstance(element, VLines): extents = extents[0], np.nan, extents[2], np.nan elif isinstance(element, HSpans): - extents = pd.array(extents) # Handle both nan and None - extents = np.nan, extents[:2].min(), np.nan, extents[2:].max() + extents = np.nan, min(extents[:2]), np.nan, max(extents[2:]) elif isinstance(element, VSpans): - extents = pd.array(extents) # Handle both nan and None - extents = extents[:2].min(), np.nan, extents[2:].max(), np.nan + extents = min(extents[:2]), np.nan, max(extents[2:]), np.nan return extents def initialize_plot(self, ranges=None):