.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/map_plots/map_scatter_integer_categories.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_map_plots_map_scatter_integer_categories.py: Map scatter (integer categories) ================================ Integer categories with an automatic discrete color scale and colorbar. .. GENERATED FROM PYTHON SOURCE LINES 7-34 .. image-sg:: /examples/map_plots/images/sphx_glr_map_scatter_integer_categories_001.png :alt: Map scatter (integer categories) :srcset: /examples/map_plots/images/sphx_glr_map_scatter_integer_categories_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np from emcpy.plots.map_plots import MapScatter from emcpy.plots.create_plots import CreatePlot, CreateFigure rng = np.random.default_rng(1) n = 600 lat = rng.uniform(25, 49, n) lon = rng.uniform(-125, -67, n) cat = rng.integers(0, 7, n) # 7 classes p = CreatePlot(projection="plcarr", domain="conus") ms = MapScatter(lat, lon, data=cat) ms.integer_field = True # auto BoundaryNorm + discrete ticks ms.cmap = "tab10" ms.markersize = 10 p.plot_layers = [ms] p.add_map_features(["states", "coastline"]) p.add_colorbar(label="Category") p.add_title("Map scatter (integer categories)") p.add_grid() fig = CreateFigure(1, 1, figsize=(9, 5.2)) fig.plot_list = [p] fig.create_figure() fig.tight_layout() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.160 seconds) .. _sphx_glr_download_examples_map_plots_map_scatter_integer_categories.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: map_scatter_integer_categories.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: map_scatter_integer_categories.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: map_scatter_integer_categories.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_