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

Example From Docs Broken #400

Closed MBetters closed 4 years ago

MBetters commented 4 years ago

ALL software version info (this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)

condaenv.yml.txt

Description of expected behavior and the observed behavior

The example from https://hvplot.holoviz.org/user_guide/Geographic_Data.html should work. However, it gives a stack trace.

Complete, minimal, self-contained example code that reproduces the issue

import xarray as xr
import hvplot.pandas  # noqa
import hvplot.xarray  # noqa
import cartopy.crs as ccrs
try:
    from bokeh.sampledata.airport_routes import airports
except:
    # This is run when the bokeh sample data hasn't been downloaded yet
    import bokeh
    bokeh.sampledata.download()
    from bokeh.sampledata.airport_routes import airports
airports.head(3)
airports.hvplot.points('Longitude', 'Latitude', geo=True, color='red', alpha=0.2,
                       xlim=(-180, -30), ylim=(0, 72), tiles='ESRI')

Stack traceback and/or browser JavaScript console output

When the above code is run in a JupyterLab notebook, it gives...

---------------------------------------------------------------------
ValueError                          Traceback (most recent call last)
<ipython-input-4-e12fbab04e2b> in <module>
      1 airports.hvplot.points('Longitude', 'Latitude', geo=True, color='red', alpha=0.2,
----> 2                        xlim=(-180, -30), ylim=(0, 72), tiles='ESRI')

~/miniconda3/envs/pnt-visualizations/lib/python3.7/site-packages/hvplot/plotting/core.py in points(self, x, y, **kwds)
    489             The HoloViews representation of the plot.
    490         """
--> 491         return self(x, y, kind='points', **kwds)
    492 
    493     def vectorfield(self, x=None, y=None, angle=None, mag=None, **kwds):

~/miniconda3/envs/pnt-visualizations/lib/python3.7/site-packages/hvplot/plotting/core.py in __call__(self, x, y, kind, **kwds)
     70                 return pn.panel(plot, **panel_dict)
     71 
---> 72         return self._get_converter(x, y, kind, **kwds)(kind, x, y)
     73 
     74     def _get_converter(self, x=None, y=None, kind=None, **kwds):

~/miniconda3/envs/pnt-visualizations/lib/python3.7/site-packages/hvplot/plotting/core.py in _get_converter(self, x, y, kind, **kwds)
     78         kind = kind or params.pop('kind', None)
     79         return HoloViewsConverter(
---> 80             self._data, x, y, kind=kind, **params
     81         )
     82 

~/miniconda3/envs/pnt-visualizations/lib/python3.7/site-packages/hvplot/converter.py in __init__(self, data, x, y, kind, by, use_index, group_label, value_label, backlog, persist, use_dask, crs, fields, groupby, dynamic, grid, legend, rot, title, xlim, ylim, clim, symmetric, logx, logy, loglog, hover, subplots, label, invert, stacked, colorbar, fontsize, datashade, rasterize, row, col, figsize, debug, framewise, aggregator, projection, global_extent, geo, precompute, flip_xaxis, flip_yaxis, dynspread, hover_cols, x_sampling, y_sampling, project, tools, attr_labels, coastline, tiles, sort_date, check_symmetric_max, **kwds)
    344                 y0, y1 = ylim or (py0, py1)
    345                 extents = (x0, y0, x1, y1)
--> 346                 x0, y0, x1, y1 = project_extents(extents, self.crs, proj_crs)
    347                 if xlim:
    348                     xlim = (x0, x1)

ValueError: not enough values to unpack (expected 4, got 0)

Screenshots or screencasts of the bug in action

PyVizBug

philippjfr commented 4 years ago

Are you sure that's the right environment you posted? You don't seem to have the necessary dependencies installed (e.g. geoviews is not there).

MBetters commented 4 years ago

My bad, re-exported my env and attached condaenv.yml.txt

MBetters commented 4 years ago

Ok, just retried and it worked. I must've gotten confused and used the old env.

philippjfr commented 4 years ago

Thanks for reporting back!