How to use the geoplot.polyplot function in geoplot

To help you get started, we’ve selected a few geoplot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ResidentMario / geoplot / tests / proj_tests.py View on Github external
def test_fully_parameterized_global_projections(proj, countries):
    gplt.polyplot(countries, proj)
    ax = plt.gca()
    ax.set_global()
    return plt.gcf()
github ResidentMario / geoplot / tests / proj_tests.py View on Github external
def test_subplots_global_projections(proj, countries):
    gplt.polyplot(countries, proj, ax=plt.subplot(2, 1, 1, projection=proj)).set_global()
    gplt.polyplot(countries, proj, ax=plt.subplot(2, 1, 2, projection=proj)).set_global()
    return plt.gcf()
github ResidentMario / geoplot / tests / property_tests.py View on Github external
def test_polyplot(self):
        gplt.polyplot(gaussian_polys, projection=None)
        gplt.polyplot(gaussian_polys, projection=gcrs.PlateCarree())
        plt.close()
github ResidentMario / geoplot / tests / proj_tests.py View on Github external
def test_partially_parameterized_global_projections(proj, countries):
    gplt.polyplot(countries, proj)
    ax = plt.gca()
    ax.set_global()
    return plt.gcf()
github ResidentMario / geoplot / docs / examples / nyc-collisions-voronoi.py View on Github external
1, 2, figsize=(16, 8), subplot_kw={'projection': proj}
)
axarr[0].axis('off')
axarr[1].axis('off')
gplt.voronoi(
    nyc_injurious_collisions.head(1000),
    edgecolor='lightsteelblue', linewidth=0.5, ax=axarr[0],
)
gplt.polyplot(nyc_boroughs, linewidth=0.5, ax=axarr[0])
gplt.voronoi(
    nyc_injurious_collisions.head(1000),
    hue='NUMBER OF PERSONS INJURED', cmap='Reds',
    edgecolor='white', clip=nyc_boroughs.geometry,
    linewidth=0.5, ax=axarr[1]
)
gplt.polyplot(nyc_boroughs, linewidth=1, ax=axarr[1])
plt.suptitle("Injurious Car Crashes in New York City, 2016", fontsize=20, y=0.95)

plt.savefig("nyc-collisions-voronoi.png", bbox_inches='tight', pad_inches=0)
github ResidentMario / geoplot / _downloads / f6bf1ef6711c3f7ae36b4a966ee6ef89 / plot_san_francisco_trees.py View on Github external
import geoplot as gplt
import geoplot.crs as gcrs
import matplotlib.pyplot as plt


trees = gpd.read_file(gplt.datasets.get_path('san_francisco_street_trees_sample'))
sf = gpd.read_file(gplt.datasets.get_path('san_francisco'))


ax = gplt.quadtree(
    trees.assign(nullity=trees['Species'].notnull().astype(int)),
    projection=gcrs.AlbersEqualArea(),
    hue='nullity', nmax=1, cmap='Greens', k=5, legend=True,
    clip=sf, edgecolor='white', linewidth=1
)
gplt.polyplot(sf, facecolor='None', edgecolor='gray', linewidth=1, zorder=2, ax=ax)

plt.savefig("san-francisco-street-trees.png", bbox_inches='tight', pad_inches=0)
github ResidentMario / geoplot / examples / plot_nyc_collisions_map.py View on Github external
)
gplt.polyplot(nyc_boroughs, ax=ax1)
ax1.set_title("Fatal Crashes in New York City, 2016")

gplt.pointplot(
    nyc_injurious_collisions, projection=proj,
    hue='BOROUGH', cmap='Set1',
    edgecolor='white', linewidth=0.5,
    scale='NUMBER OF PERSONS INJURED', limits=(4, 20),
    legend=True, legend_var='scale',
    legend_kwargs={'loc': 'upper left', 'markeredgecolor': 'black'},
    legend_values=[20, 15, 10, 5, 1],
    legend_labels=['20 Injuries', '15 Injuries', '10 Injuries', '5 Injuries', '1 Injury'],
    ax=ax2
)
gplt.polyplot(nyc_boroughs, ax=ax2, projection=proj)
ax2.set_title("Injurious Crashes in New York City, 2016")

plt.savefig("nyc-collisions-map.png", bbox_inches='tight', pad_inches=0)
github ResidentMario / geoplot / examples / plot_nyc_collision_factors.py View on Github external
proj = gcrs.AlbersEqualArea(central_latitude=40.7128, central_longitude=-74.0059)
fig = plt.figure(figsize=(10,5))
ax1 = plt.subplot(121, projection=proj)
ax2 = plt.subplot(122, projection=proj)

gplt.kdeplot(
    nyc_collision_factors[
        nyc_collision_factors['CONTRIBUTING FACTOR VEHICLE 1'] == "Failure to Yield Right-of-Way"
    ],
    cmap='Reds',
    projection=proj,
    shade=True, shade_lowest=False, 
    clip=nyc_boroughs.geometry,
    ax=ax1
)
gplt.polyplot(nyc_boroughs, zorder=1, ax=ax1)
ax1.set_title("Failure to Yield Right-of-Way Crashes, 2016")

gplt.kdeplot(
    nyc_collision_factors[
        nyc_collision_factors['CONTRIBUTING FACTOR VEHICLE 1'] == "Lost Consciousness"
    ],
    cmap = 'Reds',
    projection=proj,
    shade=True, shade_lowest=False,
    clip=nyc_boroughs.geometry,
    ax=ax2
)
gplt.polyplot(nyc_boroughs, zorder=1, ax=ax2)
ax2.set_title("Loss of Consciousness Crashes, 2016")

plt.savefig("nyc-collision-factors.png", bbox_inches='tight', pad_inches=0.1)
github ResidentMario / geoplot / docs / gallery / plot_nyc_collision_factors.py View on Github external
proj = gcrs.AlbersEqualArea(central_latitude=40.7128, central_longitude=-74.0059)
fig = plt.figure(figsize=(10,5))
ax1 = plt.subplot(121, projection=proj)
ax2 = plt.subplot(122, projection=proj)

gplt.kdeplot(
    nyc_collision_factors[
        nyc_collision_factors['CONTRIBUTING FACTOR VEHICLE 1'] == "Failure to Yield Right-of-Way"
    ],
    cmap='Reds',
    projection=proj,
    shade=True, shade_lowest=False, 
    clip=nyc_boroughs.geometry,
    ax=ax1
)
gplt.polyplot(nyc_boroughs, zorder=1, ax=ax1)
plt.title("Failure to Yield Right-of-Way Crashes, 2016")

gplt.kdeplot(
    nyc_collision_factors[
        nyc_collision_factors['CONTRIBUTING FACTOR VEHICLE 1'] == "Lost Consciousness"
    ],
    cmap = 'Reds',
    projection=proj,
    shade=True, shade_lowest=False,
    clip=nyc_boroughs.geometry,
    ax=ax2
)
gplt.polyplot(nyc_boroughs, zorder=1, ax=ax2)
plt.title("Loss of Consciousness Crashes, 2016")

plt.savefig("nyc-collision-factors.png", bbox_inches='tight', pad_inches=0.1)
github ResidentMario / geoplot / _downloads / 3dcded7153c2dd631cf592a948363b12 / plot_nyc_parking_tickets.py View on Github external
def plot_state_to_ax(state, ax):
    gplt.choropleth(
        tickets.set_index('id').loc[:, [state, 'geometry']],
        hue=state, cmap='Blues',
        linewidth=0.0, ax=ax
    )
    gplt.polyplot(
        nyc_boroughs, edgecolor='black', linewidth=0.5, ax=ax
    )