Skip to content

Instantly share code, notes, and snippets.

View geo26.py
proj = gplt.crs.AlbersEqualArea(
central_longitude=-98,
central_latitude=39.5
)
ax = gplt.voronoi(
continental_usa_cities,
hue="ELEV_IN_FT",
clip=contiguous_usa,
projection=proj,
View geo25.py
melbourne = gpd.read_file(gplt.datasets.get_path("melbourne"))
df = gpd.read_file(gplt.datasets.get_path("melbourne_schools"))
melbourne_primary_schools = df.query('School_Type == "Primary"')
ax = gplt.voronoi(
melbourne_primary_schools,
clip=melbourne,
linewidth=0.5,
edgecolor="white",
projection=gcrs.Mercator()
View geo24.py
import warnings
warnings.filterwarnings("ignore", "GeoSeries.isna", UserWarning)
View geo23.py
gplt.pointplot(
continental_usa_cities,
projection=gcrs.AlbersEqualArea(),
hue="ELEV_IN_FT",
scheme=scheme,
cmap="inferno_r",
legend=True
)
View geo22.py
scheme = mc.Quantiles(continental_usa_cities["ELEV_IN_FT"], k=10)
View geo21.py
gplt.cartogram(
geo_obesity,
scale="Percent",
projection=gcrs.AlbersEqualArea()
)
View geo20.py
geo_obesity = contiguous_usa.set_index("state").join(obesity.set_index("State"))
geo_obesity.head()
View geo19.py
obesity = pd.read_csv(gplt.datasets.get_path("obesity_by_state"), sep="\t")
obesity.head()
View geo18.py
ax = gplt.polyplot(contiguous_usa, projection=gcrs.AlbersEqualArea())
gplt.kdeplot(
continental_usa_cities,
cmap="Reds",
shade=True,
clip=contiguous_usa,
ax=ax
)
View geo17.py
boroughs = gpd.read_file(gplt.datasets.get_path("nyc_boroughs"))
collisions = gpd.read_file(gplt.datasets.get_path("nyc_collision_factors"))
ax = gplt.polyplot(boroughs, projection=gcrs.AlbersEqualArea())
gplt.kdeplot(collisions, cmap="Reds", shade=True, clip=boroughs, ax=ax)