diff --git a/geoplot/geoplot.py b/geoplot/geoplot.py index f950135..5094d42 100644 --- a/geoplot/geoplot.py +++ b/geoplot/geoplot.py @@ -1304,7 +1304,7 @@ def draw(self): sns.kdeplot( x=pd.Series([p.x for p in self.df.geometry]), y=pd.Series([p.y for p in self.df.geometry]), - transform=ccrs.PlateCarree(), ax=ax, **self.kwargs + transform=ccrs.PlateCarree()._as_mpl_transform(ax), ax=ax, **self.kwargs ) else: sns.kdeplot( diff --git a/tests/test_geoplot.py b/tests/test_geoplot.py new file mode 100644 index 0000000..b361893 --- /dev/null +++ b/tests/test_geoplot.py @@ -0,0 +1,14 @@ +import geopandas as gpd +import geoplot as gplt +import geoplot.crs as gcrs +import matplotlib.pyplot as plt +import pytest + + +def test_kdeplot_projection_when_shade_true(): + boston_airbnb_listings = gpd.read_file(gplt.datasets.get_path('boston_airbnb_listings')) + + ax = gplt.kdeplot( + boston_airbnb_listings, cmap='viridis', projection=gcrs.WebMercator(), figsize=(12, 12), + fill=True + ) \ No newline at end of file