Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does geoplot only work with EPSG:4326 unless the projection argument is set? #282

Open
mhaffner opened this issue Nov 14, 2022 · 0 comments

Comments

@mhaffner
Copy link

I'm trying to create a plot using data that is not in EPSG:4326. This is necessary since I need to make computations which require a cartesian coordinate system. This MWE returns a blank plot:

import geopandas as gpd
import geoplot as gplt
import matplotlib.pyplot as plt

# read the following dataset using geopandas method: gplt.datasets.get_path('ny_census')
ny = gpd.read_file(gplt.datasets.get_path('ny_census'))

# transform the x,y data into that of a projected CRS
ny_proj = ny.to_crs(32016)

# create a variable for population density
ny_proj['population_density'] = ny_proj['POP2000'] / ny_proj.area

# create a choropleth map of population density
gplt.choropleth(ny_proj, hue = 'POP2000')
plt.show()
# it's blank

This works, however, using the native plot() method:

ny_proj.plot()
plt.show()

I know that I could feed gplt.choropleth() an unprojected geodataframe and then specify the projection argument as something that is projected, but this feels a bit cumbersome and will result in counterintuitive results. E.g., I'd have to attach a variable back to the original ny geodataframe, and if there were units attached to this variable (e.g., meters or feet), these would not match the linear unit of the CRS.

Am I missing something in my geoplot MWE or was it only intended to work with EPSG:4326?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant