.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "example_gallery/utility/add_text_example.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_utility_add_text_example.py: Add text ======== Examples of use of ``add_text()``. .. GENERATED FROM PYTHON SOURCE LINES 7-40 .. image-sg:: /example_gallery/utility/images/sphx_glr_add_text_example_001.svg :alt: add text example :srcset: /example_gallery/utility/images/sphx_glr_add_text_example_001.svg :class: sphx-glr-single-img .. code-block:: Python ### import matplotlib.pyplot as plt from plothist import add_text fig, ax = plt.subplots() positions = [ ("right_in", "top_in"), ("left_in", "top_in"), ("left_in", "bottom_in"), ("right_in", "bottom_in"), ("right", "top_out"), ("left", "top_out"), ("right_out", "top_in"), ("right_out", "bottom_in"), ("right", "bottom_out"), ("left", "bottom_out"), ] for x, y in positions: x_label = x.replace("_", r"\_") y_label = y.replace("_", r"\_") add_text( f"$\\mathtt{{add\\_text()}}$\n" f'$\\mathtt{{x = }}$"$\\mathtt{{{x_label}}}$"\n' f'$\\mathtt{{y = }}$"$\\mathtt{{{y_label}}}$"', x=x, y=y, ) fig.savefig("add_text_example.svg", bbox_inches="tight") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.477 seconds) .. _sphx_glr_download_example_gallery_utility_add_text_example.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: add_text_example.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: add_text_example.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: add_text_example.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_