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.06k stars 103 forks source link

Missing Point in display #56

Closed ea42gh closed 5 years ago

ea42gh commented 6 years ago
import holoviews as hv
hv.extension('bokeh')
import geoviews

from shapely.geometry import Point
import pandas as pd
import geopandas as gpd
from geopandas import GeoSeries, GeoDataFrame
import hvplot.pandas
from geopandas import GeoSeries, GeoDataFrame
from shapely.geometry import Point

data = {'name': ['House', 'Work', 'Pet Store'],
        'lat': [  45,   46,     47.5],
        'lon': [-120, -121.2, -122.9]}
df = pd.DataFrame(data)
geo = [Point(xy) for xy in zip(data['lon'], data['lat'])]
gdf = GeoDataFrame(df, geometry=geo)

gdf.hvplot().options(size=15,color='green',marker='*')

The plot correctly sizes the axis ranges, but the third point is not displayed

{'matplotlib': '2.2.2', 'pandas': '0.23.2', 'geopandas': '0.3.0', 'holoviews': '1.11.0a1.post3+g103daf59-dirty'} hvplot from master v0.2.1 (july 9)

philippjfr commented 6 years ago

Thanks, the example is not working for me, could you make it fully reproducible and define df?

ea42gh commented 6 years ago

oops, fixed in the example above! Found that I needed to import geoviews as well for some reason having to do with kdims Longitude,Latitude

philippjfr commented 6 years ago

The GeopandasInterface lives in geoviews so without importing it HoloViews does not understand the geometries.

philippjfr commented 6 years ago

Thanks, fixed in https://github.com/pyviz/geoviews/pull/204

ea42gh commented 6 years ago

great! Thank you! Did I miss the geoviews dependency in the documentation?

philippjfr commented 6 years ago

No, that's a bug, when you use geopandas it should import geoviews for you.

philippjfr commented 5 years ago

Fixed, it will now import geoviews automatically and error if it isn't available.