How to use the geoplot.aggplot 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 / property_tests.py View on Github external
def test_aggplot(self, projection,
                     sankey_hue,
                     legend_vars,
                     sankey_data_inputs):
        kwargs = {'projection': projection, 'hue': sankey_hue}
        kwargs = {**kwargs, **legend_vars, **sankey_data_inputs}
        try: gplt.aggplot(agg_data, **kwargs)
        finally: plt.close()
github ResidentMario / geoplot / tests / kwarg_tests.py View on Github external
def test_aggplot(self):
        try:
            gplt.aggplot(dataframe_gaussian_points, hue='mock_category', 
                         projection=gcrs.PlateCarree())

            gplt.aggplot(dataframe_gaussian_points, hue='mock_category', by='mock_category',
                         projection=gcrs.PlateCarree())
        finally:
            plt.close()
github ResidentMario / geoplot / tests / input_tests.py View on Github external
def test_aggplot(self):
        try:
            gplt.aggplot(series_gaussian_points, hue=list_hue_values)
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values)

            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values)
            gplt.aggplot(dataframe_gaussian_points, hue=series_hue_values)
            gplt.aggplot(dataframe_gaussian_points, hue=map_hue_values())
            gplt.aggplot(dataframe_gaussian_points, hue='hue_var')

            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values, by='mock_category')
            # series
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=dataframe_gaussian_points['mock_category'])
            # list
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=list(dataframe_gaussian_points['mock_category']))
            # map
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=map(lambda v: v, list(dataframe_gaussian_points['mock_category'])))
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values, by='mock_category',
                         geometry=aggplot_geometries)
github ResidentMario / geoplot / tests / input_tests.py View on Github external
def test_aggplot(self):
        try:
            gplt.aggplot(series_gaussian_points, hue=list_hue_values)
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values)

            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values)
            gplt.aggplot(dataframe_gaussian_points, hue=series_hue_values)
            gplt.aggplot(dataframe_gaussian_points, hue=map_hue_values())
            gplt.aggplot(dataframe_gaussian_points, hue='hue_var')

            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values, by='mock_category')
            # series
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=dataframe_gaussian_points['mock_category'])
            # list
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=list(dataframe_gaussian_points['mock_category']))
            # map
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
github ResidentMario / geoplot / tests / input_tests.py View on Github external
gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values, by='mock_category')
            # series
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=dataframe_gaussian_points['mock_category'])
            # list
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=list(dataframe_gaussian_points['mock_category']))
            # map
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=map(lambda v: v, list(dataframe_gaussian_points['mock_category'])))
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values, by='mock_category',
                         geometry=aggplot_geometries)
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=dataframe_gaussian_points['mock_category'],
                         geometry=aggplot_geometries)  # Series
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=list(dataframe_gaussian_points['mock_category']),
                         geometry=aggplot_geometries)  # List
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=map(lambda v: v, list(dataframe_gaussian_points['mock_category'])),
                         geometry=aggplot_geometries)  # Map

        finally:
            plt.close('all')
github ResidentMario / geoplot / tests / input_tests.py View on Github external
gplt.aggplot(dataframe_gaussian_points, hue=map_hue_values())
            gplt.aggplot(dataframe_gaussian_points, hue='hue_var')

            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values, by='mock_category')
            # series
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=dataframe_gaussian_points['mock_category'])
            # list
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=list(dataframe_gaussian_points['mock_category']))
            # map
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=map(lambda v: v, list(dataframe_gaussian_points['mock_category'])))
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values, by='mock_category',
                         geometry=aggplot_geometries)
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=dataframe_gaussian_points['mock_category'],
                         geometry=aggplot_geometries)  # Series
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=list(dataframe_gaussian_points['mock_category']),
                         geometry=aggplot_geometries)  # List
            gplt.aggplot(dataframe_gaussian_points, hue=list_hue_values,
                         by=map(lambda v: v, list(dataframe_gaussian_points['mock_category'])),
                         geometry=aggplot_geometries)  # Map

        finally:
            plt.close('all')
github ResidentMario / geoplot / docs / examples / aggplot-collisions.py View on Github external
# Plot the data.
import geoplot as gplt
import geoplot.crs as gcrs
import numpy as np
import matplotlib.pyplot as plt

f, axarr = plt.subplots(3, 1, figsize=(12, 12), subplot_kw={
    'projection': gcrs.AlbersEqualArea(central_latitude=40.7128, central_longitude=-74.0059)
})
plt.suptitle('Max(Injuries) in Collision by Area, 2016', fontsize=16)
plt.subplots_adjust(top=0.95)


ax1 = gplt.aggplot(collisions, projection=gcrs.AlbersEqualArea(),
                   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(),
github ResidentMario / geoplot / docs / examples / aggplot-collisions.py View on Github external
f, axarr = plt.subplots(3, 1, figsize=(12, 12), subplot_kw={
    'projection': gcrs.AlbersEqualArea(central_latitude=40.7128, central_longitude=-74.0059)
})
plt.suptitle('Max(Injuries) in Collision by Area, 2016', fontsize=16)
plt.subplots_adjust(top=0.95)


ax1 = gplt.aggplot(collisions, projection=gcrs.AlbersEqualArea(),
                   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 / missingno / missingno / missingno.py View on Github external
if by:
        if df[by].isnull().any():
            warnings.warn('The "{0}" column included null values. The offending records were dropped'.format(by))
            df = df.dropna(subset=[by])
            gdf = gdf.loc[df.index]

        vc = df[by].value_counts()
        if (vc < 3).any():
            warnings.warn('Grouping by "{0}" included clusters with fewer than three points, which cannot be made '
                          'polygonal. The offending records were dropped.'.format(by))
            where = df[by].isin((df[by].value_counts() > 2).where(lambda b: b).dropna().index.values)
            gdf = gdf.loc[where]
        gdf[by] = df[by]

    gplt.aggplot(gdf, figsize=figsize, hue='nullity', agg=np.average, cmap=cmap, by=by, edgecolor='None', **kwargs)
    ax = plt.gca()

    if inline:
        warnings.warn(
            "The 'inline' argument has been deprecated, and will be removed in a future version "
            "of missingno."
        )
        plt.show()
    else:
        return ax