Skip to content

Instantly share code, notes, and snippets.

View ceteri's full-sized avatar

Paco Nathan ceteri

View GitHub Profile
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,
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()
import warnings
warnings.filterwarnings("ignore", "GeoSeries.isna", UserWarning)
gplt.pointplot(
continental_usa_cities,
projection=gcrs.AlbersEqualArea(),
hue="ELEV_IN_FT",
scheme=scheme,
cmap="inferno_r",
legend=True
)
scheme = mc.Quantiles(continental_usa_cities["ELEV_IN_FT"], k=10)
gplt.cartogram(
geo_obesity,
scale="Percent",
projection=gcrs.AlbersEqualArea()
)
geo_obesity = contiguous_usa.set_index("state").join(obesity.set_index("State"))
geo_obesity.head()
obesity = pd.read_csv(gplt.datasets.get_path("obesity_by_state"), sep="\t")
obesity.head()
ax = gplt.polyplot(contiguous_usa, projection=gcrs.AlbersEqualArea())
gplt.kdeplot(
continental_usa_cities,
cmap="Reds",
shade=True,
clip=contiguous_usa,
ax=ax
)
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)