.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "example_gallery/1d_hist/1d_elt2.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_1d_hist_1d_elt2.py: Histogram with uncertainties ============================ Plot a 1D histogram with error bars using ``plot_error_hist()``. .. GENERATED FROM PYTHON SOURCE LINES 7-34 .. image-sg:: /example_gallery/1d_hist/images/sphx_glr_1d_elt2_001.svg :alt: 1d elt2 :srcset: /example_gallery/1d_hist/images/sphx_glr_1d_elt2_001.svg :class: sphx-glr-single-img .. code-block:: Python from plothist_utils import get_dummy_data df = get_dummy_data() ### import matplotlib.pyplot as plt from plothist import make_hist, plot_error_hist name = "variable_1" category = "category" x1 = df[name][df[category] == 3] h1 = make_hist(x1) fig, ax = plt.subplots() plot_error_hist(h1, ax=ax, color="black", label="$h1_{err}$") ax.set_xlabel(name) ax.set_ylabel("Entries") ax.set_ylim(ymin=0) ax.legend() fig.savefig("1d_elt2.svg", bbox_inches="tight") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.620 seconds) .. _sphx_glr_download_example_gallery_1d_hist_1d_elt2.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 1d_elt2.ipynb <1d_elt2.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 1d_elt2.py <1d_elt2.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 1d_elt2.zip <1d_elt2.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_