.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "plot_types/statistical/hexbin.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_plot_types_statistical_hexbin.py: HexBin ====== Density of points with :class:`HexBin` and a colorbar. .. GENERATED FROM PYTHON SOURCE LINES 7-35 .. image-sg:: /plot_types/statistical/images/sphx_glr_hexbin_001.png :alt: HexBin :srcset: /plot_types/statistical/images/sphx_glr_hexbin_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np from emcpy.plots.plots import HexBin from emcpy.plots.create_plots import CreatePlot, CreateFigure rng = np.random.default_rng(2) x = rng.normal(size=5000) y = x * 0.5 + rng.normal(scale=0.7, size=5000) p = CreatePlot() layers = [] hb = HexBin(x, y) hb.gridsize = 35 hb.cmap = "viridis" layers.append(hb) p.plot_layers = layers p.add_title("HexBin") p.add_xlabel("x") p.add_ylabel("y") p.add_grid(alpha=0.3) p.add_colorbar(label="count") fig = CreateFigure(1, 1, figsize=(6.8, 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.116 seconds) .. _sphx_glr_download_plot_types_statistical_hexbin.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: hexbin.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: hexbin.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: hexbin.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_