holoviz / hvplot

A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews
https://hvplot.holoviz.org
BSD 3-Clause "New" or "Revised" License
1.08k stars 105 forks source link

geopandas hvplot groupby fails #63

Closed ahuang11 closed 5 years ago

ahuang11 commented 6 years ago
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world.hvplot(width=550) + world.hvplot(groupby='continent', width=500)

KeyError: "Dimension 'continent' not found."

ahuang11 commented 5 years ago

import geopandas as gpd import hvplot.pandas

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) world.hvplot(groupby='continent', width=500)

/mnt/c/Users/sephi/GOOGLE~1/Bash/geoviews/geoviews/data/geopandas.py in validate(cls, dataset, vdims)
     81                             'coordinates but %d dimensions were found '
     82                             'which did not refer to any columns.'
---> 83                             % (type(dataset).__name__, len(geom_dims)), cls)
     84         not_found = [d.name for d in dataset.dimensions(dim_types)
     85                      if d not in geom_dims and d.name not in dataset.data]

DataError: Expected Dataset instance to declare two key dimensions corresponding to the geometry coordinates but 0 dimensions were found which did not refer to any columns.

new error

jsignell commented 5 years ago

Is this still an issue? I think c is the appropriate option to use in this case:

Screen Shot 2019-06-25 at 3 44 36 PM

I think the original issue came up because polygons doesn't support the option groupby:

Screen Shot 2019-06-25 at 3 46 57 PM