How to use the geoplot.crs.Orthographic 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.Orthographic(), marks=pytest.mark.xfail),
    gcrs.Stereographic(),
    pytest.param(gcrs.TransverseMercator(), marks=pytest.mark.xfail),
    gcrs.LambertAzimuthalEqualArea(),
    gcrs.WebMercator()
])
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 / mixin_tests.py View on Github external
plot = Plot(self.nonempty_gdf, **{
            **self.kwargs, **{'extent': (-1, -1, 1, 1), 'projection': gcrs.PlateCarree()}
        })
        xmin, xmax = plot.ax.get_xlim()
        ymin, ymax = plot.ax.get_ylim()
        assert xmin == -1
        assert xmax == 1
        assert ymin == -1
        assert ymax == 1

        # nonempty geometry, unsatisfiable extent case: warn and fall back to default
        with pytest.warns(UserWarning):
            # Orthographic can only show one half of the world at a time
            Plot(self.nonempty_gdf, **{
                **self.kwargs,
                **{'extent': (-180, -90, 180, 90), 'projection': gcrs.Orthographic()}
            })
github ResidentMario / geoplot / tests / proj_tests.py View on Github external
    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(central_latitude=45),
    gcrs.Stereographic(central_longitude=45),
    gcrs.Stereographic(central_latitude=45),
    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 / _downloads / 8efa1a8bcdf03742257042ac84c2cdce / plot_los_angeles_flights.py View on Github external
For more information visit `the cartopy docs
`_.
"""

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

la_flights = gpd.read_file(gplt.datasets.get_path('la_flights'))


f, axarr = plt.subplots(2, 2, figsize=(12, 12), subplot_kw={
    'projection': gcrs.Orthographic(central_latitude=40.7128, central_longitude=-74.0059)
})
plt.suptitle('Popular Flights out of Los Angeles, 2016', fontsize=16)
plt.subplots_adjust(top=0.95)

ax = gplt.sankey(
    la_flights, scale='Passengers', hue='Passengers', cmap='Purples', k=5, ax=axarr[0][0]
)
ax.set_global()
ax.outline_patch.set_visible(True)
ax.coastlines()

ax = gplt.sankey(
    la_flights, scale='Passengers', hue='Passengers', cmap='Purples', k=5, ax=axarr[0][1]
)
ax.set_global()
ax.outline_patch.set_visible(True)
github ResidentMario / geoplot / docs / gallery / plot_los_angeles_flights.py View on Github external
For more information visit `the cartopy docs
`_.
"""

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

la_flights = gpd.read_file(gplt.datasets.get_path('la_flights'))


f, axarr = plt.subplots(2, 2, figsize=(12, 12), subplot_kw={
    'projection': gcrs.Orthographic(central_latitude=40.7128, central_longitude=-74.0059)
})
plt.suptitle('Popular Flights out of Los Angeles, 2016', fontsize=16)
plt.subplots_adjust(top=0.95)

ax = gplt.sankey(
    la_flights, scale='Passengers', hue='Passengers', cmap='Purples', ax=axarr[0][0]
)
ax.set_global()
ax.outline_patch.set_visible(True)
ax.coastlines()

ax = gplt.sankey(
    la_flights, scale='Passengers', hue='Passengers', cmap='Purples', ax=axarr[0][1]
)
ax.set_global()
ax.outline_patch.set_visible(True)
github geopandas / geopandas / examples / plotting_with_geoplot.py View on Github external
###############################################################################
# Plotting with Geoplot
# =====================
#
# We start out by replicating the basic GeoPandas world plot using Geoplot.
geoplot.polyplot(world, figsize=(8, 4))

###############################################################################
# Geoplot can re-project data into any of the map projections provided by
# CartoPy (see the list
# `here `_).

# use the Orthographic map projection (e.g. a world globe)
ax = geoplot.polyplot(
    world, projection=geoplot.crs.Orthographic(), figsize=(8, 4)
)
ax.outline_patch.set_visible(True)

###############################################################################
# ``polyplot`` is trivial and can only plot the geometries you pass to it. If
# you want to use color as a visual variable, specify a ``choropleth``. Here
# we sort GDP per person by country into five buckets by color, using
# "quantiles" binning from the `Mapclassify `_
# library.

import mapclassify
gpd_per_person = world['gdp_md_est'] / world['pop_est']
scheme = mapclassify.Quantiles(gpd_per_person, k=5)

# Note: this code sample requires geoplot>=0.4.0.
geoplot.choropleth(