.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "example_gallery/2d_hist/2d_hist_simple.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_example_gallery_2d_hist_2d_hist_simple.py: 2D histogram ============ Plot a 2D histogram with ``plot_2d_hist()``. .. GENERATED FROM PYTHON SOURCE LINES 7-29 .. image-sg:: /example_gallery/2d_hist/images/sphx_glr_2d_hist_simple_001.svg :alt: 2d hist simple :srcset: /example_gallery/2d_hist/images/sphx_glr_2d_hist_simple_001.svg :class: sphx-glr-single-img .. code-block:: Python from plothist_utils import get_dummy_data df = get_dummy_data() ### from plothist import make_2d_hist, plot_2d_hist name_x = "variable_0" name_y = "variable_1" h = make_2d_hist([df[name_x], df[name_y]], bins=[10, 10]) fig, ax, ax_colorbar = plot_2d_hist(h, colorbar_kwargs={"label": "Entries"}) ax.set_xlabel(name_x) ax.set_ylabel(name_y) ax.set_xlim(-9, 9) ax.set_ylim(-9, 9) fig.savefig("2d_hist_simple.svg", bbox_inches="tight") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.869 seconds) .. _sphx_glr_download_example_gallery_2d_hist_2d_hist_simple.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 2d_hist_simple.ipynb <2d_hist_simple.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 2d_hist_simple.py <2d_hist_simple.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 2d_hist_simple.zip <2d_hist_simple.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_