How to use the geoplot.crs 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
    pytest.param(gcrs.TransverseMercator(central_longitude=45), marks=pytest.mark.xfail),
    pytest.param(gcrs.TransverseMercator(central_latitude=45), marks=pytest.mark.xfail),
    pytest.param(gcrs.LambertAzimuthalEqualArea(central_longitude=45), marks=pytest.mark.xfail),
    gcrs.LambertAzimuthalEqualArea(central_latitude=45),
])
def test_partially_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
    gcrs.LambertConformal(central_longitude=45, central_latitude=45),
    gcrs.Orthographic(central_longitude=45, central_latitude=45),
    gcrs.Stereographic(central_longitude=45, central_latitude=45),
    pytest.param(
        gcrs.TransverseMercator(central_longitude=45, central_latitude=45),
        marks=pytest.mark.xfail
    ),
    gcrs.LambertAzimuthalEqualArea(central_longitude=45, central_latitude=45),
])
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
    gcrs.Orthographic(),
    gcrs.Stereographic(),
    pytest.param(gcrs.TransverseMercator(), marks=pytest.mark.xfail),
    gcrs.LambertAzimuthalEqualArea(),
    gcrs.WebMercator()
])
def test_basic_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
    gcrs.OSGB(),
])
def test_basic_non_global_projections(proj, countries):
    with warnings.catch_warnings():
        warnings.simplefilter("ignore")
        gplt.polyplot(countries, proj)
    return plt.gcf()
github ResidentMario / geoplot / docs / examples / aggplot-collisions.py View on Github external
hue='NUMBER OF PERSONS INJURED', agg=np.max, cmap='Reds',
                   nmin=100, nmax=500,
                   linewidth=0.5, edgecolor='white',
                   ax=axarr[0])
ax1.set_title("No Geometry (Quadtree)")


ax2 = gplt.aggplot(collisions, projection=gcrs.AlbersEqualArea(),
                   hue='NUMBER OF PERSONS INJURED', agg=np.max, cmap='Reds', by='ZIP CODE',
                   linewidth=0.5, edgecolor='white',
                   ax=axarr[1])
ax2.set_title("Categorical Geometry (Convex Hull)")


zip_codes = gplt.datasets.load('nyc-zip-codes')
ax3 = gplt.aggplot(collisions, projection=gcrs.AlbersEqualArea(),
                   hue='NUMBER OF PERSONS INJURED', agg=np.max, by='ZIP CODE', geometry=zip_codes.geometry,
                   cmap='Reds', linewidth=0.5, edgecolor='white',
                   ax=axarr[2])
ax3.set_title("Geometry Provided (Choropleth)")


plt.savefig("aggplot-collisions-1.png", bbox_inches='tight', pad_inches=0.1)
github ResidentMario / geoplot / _downloads / 600d8a8b8575df48f2e217113a87b09f / plot_boston_airbnb_kde.py View on Github external
overwhelming the renderer.

`Click here to see this plot as an interactive webmap. 
`_
"""

import geopandas as gpd
import geoplot as gplt
import geoplot.crs as gcrs
import matplotlib.pyplot as plt
import mplleaflet

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),
    shade=True
)
gplt.pointplot(boston_airbnb_listings, s=1, color='black', ax=ax)
gplt.webmap(boston_airbnb_listings, ax=ax)
plt.title('Boston AirBnB Locations, 2016', fontsize=18)

fig = plt.gcf()
plt.savefig("boston-airbnb-kde.png", bbox_inches='tight', pad_inches=0.1)
# mplleaflet.show(fig)
github geopandas / geopandas / examples / plotting_with_geoplot.py View on Github external
africa = world.query('continent == "Africa"')
ax = geoplot.cartogram(
    africa, scale='pop_est', limits=(0.2, 1),
    edgecolor='None', figsize=(7, 8)
)
geoplot.polyplot(africa, edgecolor='gray', ax=ax)

###############################################################################
# If we have data in the shape of points in space, we may generate a
# three-dimensional heatmap on it using ``kdeplot``.

ax = geoplot.kdeplot(
    collisions.head(1000), clip=boroughs.geometry,
    shade=True, cmap='Reds',
    projection=geoplot.crs.AlbersEqualArea())
geoplot.polyplot(boroughs, ax=ax, zorder=1)

###############################################################################
# Alternatively, we may partition the space into neighborhoods automatically,
# using Voronoi tessellation. This is a good way of visually verifying whether
# or not a certain data column is spatially correlated.

ax = geoplot.voronoi(
    collisions.head(1000), projection=geoplot.crs.AlbersEqualArea(),
    clip=boroughs.simplify(0.001),
    hue='NUMBER OF PERSONS INJURED', cmap='Reds',
    legend=True,
    edgecolor='white'
)
geoplot.polyplot(boroughs, edgecolor='black', zorder=1, ax=ax)