0

I'm having a bit of trouble plotting polygon/multipolygon data with Geoviews. I have made a geodataframe that combines my two datasets together nicely. I am able to plot the data easily using the plot function:

See below:

import geopandas as gpd
import numpy as np
import pandas as pd
import holoviews as hv
import geoviews as gv
import geoviews.feature as gf
import cartopy
import cartopy.feature as cf

from geoviews import opts
from cartopy import crs as ccrs

gv.extension('bokeh')

Drop_na.plot(column = 'Registrations',figsize=(10,10), legend=True)

This gives me the below chart:

enter image description here

However, when I try to plot the same using GeoViews with the code below:

gv.Polygons(Drop_na, vdims=['Registrations']).opts(
tools=['hover'], width=550, height=700, color_index='Registrations',
colorbar=True, toolbar='above', xaxis=None, yaxis=None, padding=0.1)

I get the following error: "While projecting a Polygons element from a PlateCarree coordinate reference system (crs) to a PlateCarree projection none of the projected paths were contained within the bounds specified by the projection. Ensure you have specified the correct coordinate system for your data."

I've read around the documentation and have tried different ways of messing around with the projection method but i just can't get it generate the same chart or any chart for that matter.

Does anyone know what i'm doing wrong?

Kind regards, Amen

Amen_90
  • 310
  • 2
  • 9
  • 1
    It's hard to debug anything without runnable code, but if you're already used to .plot(), you can try hvPlot, which uses the .plot() API to construct GeoViews elements. See https://hvplot.holoviz.org/user_guide/Geographic_Data.html , or just do `import hvplot.pandas ; Drop_na.plot('Registrations')` – James A. Bednar Feb 21 '20 at 03:12
  • 1
    Yep, hvplot did the trick! Thanks a bunch! – Amen_90 Feb 26 '20 at 16:53

0 Answers0