.. only:: html
.. note::
:class: sphx-glr-download-link-note
Click :ref:`here ` to download the full example code
.. rst-class:: sphx-glr-example-title
.. _sphx_glr_gallery_text_labels_and_annotations_dashpointlabel.py:
===============
Dashpoint Label
===============
.. image:: /gallery/text_labels_and_annotations/images/sphx_glr_dashpointlabel_001.png
:alt: NOTE: The withdash parameter is deprecated.
:class: sphx-glr-single-img
.. code-block:: default
import warnings
import matplotlib.pyplot as plt
warnings.simplefilter("ignore") # Ignore deprecation of withdash.
DATA = ((1, 3),
(2, 4),
(3, 1),
(4, 2))
# dash_style =
# direction, length, (text)rotation, dashrotation, push
# (The parameters are varied to show their effects, not for visual appeal).
dash_style = (
(0, 20, -15, 30, 10),
(1, 30, 0, 15, 10),
(0, 40, 15, 15, 10),
(1, 20, 30, 60, 10))
fig, ax = plt.subplots()
(x, y) = zip(*DATA)
ax.plot(x, y, marker='o')
for i in range(len(DATA)):
(x, y) = DATA[i]
(dd, dl, r, dr, dp) = dash_style[i]
t = ax.text(x, y, str((x, y)), withdash=True,
dashdirection=dd,
dashlength=dl,
rotation=r,
dashrotation=dr,
dashpush=dp,
)
ax.set_xlim((0, 5))
ax.set_ylim((0, 5))
ax.set(title="NOTE: The withdash parameter is deprecated.")
plt.show()
.. _sphx_glr_download_gallery_text_labels_and_annotations_dashpointlabel.py:
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-example
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: dashpointlabel.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: dashpointlabel.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
Keywords: matplotlib code example, codex, python plot, pyplot
`Gallery generated by Sphinx-Gallery
`_