Open ahuang11 opened 3 years ago
Any way to reproduce? Presumably t_m here is NaN, implying that the bounds are NaN, so I'd suspect an empty plot is being encountered somehow?
Zoom too close on some points that are spread too far apart (thus no points within frame range triggering NaN) using geoviews + tiles I think?
If you can find an example plot we can run and give a step-by-step guide, we can check it out!
Maybe not related to datashader, maybe related to https://discourse.holoviz.org/t/show-individual-points-when-zoomed-else-datashade/2204
Okay I got a reproducible example; has to do with responsive=True.
Basically go wild zooming (zoom in really fast and out) then the error should pop up eventually.
import datashader as ds
import holoviews as hv
import geoviews as gv
import numpy as np
import cartopy.crs as ccrs
import pandas as pd
import panel as pn
from holoviews.operation.datashader import rasterize
hv.extension("bokeh")
df = pd.DataFrame(np.random.rand(1000, 3), columns=["x", "y", "z"]) * 10
points = gv.Points(df, kdims=["x", "y"], vdims=["z"], crs=ccrs.PlateCarree())
def filter_points(points, x_range, y_range):
if x_range is None or y_range is None:
return points
return points[x_range, y_range]
def hover_points(points, threshold=50):
if len(points) > threshold:
return points.iloc[:0]
return points
range_stream = hv.streams.RangeXY(source=points)
streams=[range_stream]
filtered = points.apply(filter_points, streams=streams)
shaded = rasterize(filtered, streams=streams, aggregator="max", x_sampling=0.25, y_sampling=0.25)
hover = filtered.apply(hover_points)
dynamic_hover = (shaded * hover)
row = pn.pane.HoloViews((gv.tile_sources.ESRI() * dynamic_hover).opts(responsive=True),sizing_mode='stretch_both', height=500)
row.servable()
Thanks for the reproducible example! I'll try it now and see if I can confirm this...
Sometimes happens: