Closed zephyrthenoble closed 6 years ago
@zephyrthenoble this is an issue with poor error messages in HoloViews, which we should really improve. The issue is that columnar data like your dataframe cannot be turned into an Image just like that, because it has to be binned first. Depending on the size of your data I'd either visualize it as a set of points or use the datashader
library to aggregate it into an Image.
tiles = gv.WMTS('https://maps.wikimedia.org/osm-intl/{Z}/{X}/{Y}@2x.png')
points = piq_ds.to(hv.Points, ['longitude', 'latitude'], ['count'], ['time'], dynamic=True)
# If the number of points is small I'd just plot it like this
%%opts Points [width=600 height=400 color_index='count'] (cmap='viridis')
tiles * points
# If the number of points is large (>10k) use datashader
# Install it with: conda install -c bokeh datashader
%%opts RGB [width=600 height=400]
import datashader as ds
from holoviews.operation.datashader import datashade
tiles * datashade(points, aggregator=ds.sum('count'))
Ah, that makes sense. I was able to get the data to render. Thank you very much!
I have a Pandas DataFrame containing data with the columns latitude, longitude, time, and count. I turn this DataFrame into a Dataset using this command
piq_ds = gv.Dataset(df, kdims=['longitude', 'latitude', 'time'])
.When I try to visualize this Dataset, using
piq_ds.to.image(['longitude', 'latitude'], ['count'], ['time'])
, I get a long error:I am a novice to geoviews, holoviews, bokeh, and visualizing geospatial data in general. Is this a bug in geoviews/holoviews, or is this caused by something I did?
Thanks!