Skip to content

Commit

Permalink
Reverts changes I can't recreate
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Sep 29, 2023
1 parent 164949e commit 6b506b7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
7 changes: 2 additions & 5 deletions holoviews/plotting/bokeh/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '
Expand Down
7 changes: 2 additions & 5 deletions holoviews/plotting/mpl/annotation.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 6b506b7

Please sign in to comment.