.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_largest_cities_usa.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_plot_largest_cities_usa.py: Pointplot of US cities by population ==================================== This example, taken from the User Guide, plots cities in the contiguous United States by their population. It demonstrates some of the range of styling options available in ``geoplot``. .. GENERATED FROM PYTHON SOURCE LINES 8-46 .. image:: /gallery/images/sphx_glr_plot_largest_cities_usa_001.png :alt: Large cities in the contiguous United States, 2010 :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Text(0.5, 1.0, 'Large cities in the contiguous United States, 2010') | .. code-block:: default import geopandas as gpd import geoplot as gplt import geoplot.crs as gcrs import matplotlib.pyplot as plt import mapclassify as mc continental_usa_cities = gpd.read_file(gplt.datasets.get_path('usa_cities')) continental_usa_cities = continental_usa_cities.query('STATE not in ["AK", "HI", "PR"]') contiguous_usa = gpd.read_file(gplt.datasets.get_path('contiguous_usa')) scheme = mc.Quantiles(continental_usa_cities['POP_2010'], k=5) ax = gplt.polyplot( contiguous_usa, zorder=-1, linewidth=1, projection=gcrs.AlbersEqualArea(), edgecolor='white', facecolor='lightgray', figsize=(12, 7) ) gplt.pointplot( continental_usa_cities, scale='POP_2010', limits=(2, 30), hue='POP_2010', cmap='Blues', scheme=scheme, legend=True, legend_var='scale', legend_values=[8000000, 2000000, 1000000, 100000], legend_labels=['8 million', '2 million', '1 million', '100 thousand'], legend_kwargs={'frameon': False, 'loc': 'lower right'}, ax=ax ) plt.title("Large cities in the contiguous United States, 2010") .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.280 seconds) .. _sphx_glr_download_gallery_plot_largest_cities_usa.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_largest_cities_usa.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_largest_cities_usa.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_