.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_minard_napoleon_russia.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_minard_napoleon_russia.py: Sankey of Napoleon's march on Moscow with custom colormap ========================================================= This example reproduces a famous historical flow map: Charles Joseph Minard's map depicting Napoleon's disastrously costly 1812 march on Russia during the Napoleonic Wars. This plot demonstrates building and using a custom ``matplotlib`` colormap. To learn more refer to `the matplotlib documentation `_. `Click here `_ to see an interactive scrolly-panny version of this webmap built with ``mplleaflet``. To learn more about ``mplleaflet``, refer to `the mplleaflet GitHub repo `_. .. GENERATED FROM PYTHON SOURCE LINES 16-38 .. image:: /gallery/images/sphx_glr_plot_minard_napoleon_russia_001.png :alt: plot minard napoleon russia :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none | .. code-block:: default import geopandas as gpd import geoplot as gplt from matplotlib.colors import LinearSegmentedColormap napoleon_troop_movements = gpd.read_file(gplt.datasets.get_path('napoleon_troop_movements')) colors = [(215 / 255, 193 / 255, 126 / 255), (37 / 255, 37 / 255, 37 / 255)] cm = LinearSegmentedColormap.from_list('minard', colors) gplt.sankey( napoleon_troop_movements, scale='survivors', limits=(0.5, 45), hue='direction', cmap=cm ) # Uncomment and run the following lines of code to save as an interactive webmap. # import matplotlib.pyplot as plt # import mplleaflet # fig = plt.gcf() # mplleaflet.save_html(fig, fileobj='minard-napoleon-russia.html') .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.211 seconds) .. _sphx_glr_download_gallery_plot_minard_napoleon_russia.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_minard_napoleon_russia.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_minard_napoleon_russia.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_