.. 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_watermark_text.py:
==============
Text watermark
==============
A watermark effect can be achieved by drawing a semi-transparent text.
.. code-block:: default
import numpy as np
import matplotlib.pyplot as plt
# Fixing random state for reproducibility
np.random.seed(19680801)
fig, ax = plt.subplots()
ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange')
ax.grid()
ax.text(0.5, 0.5, 'created with matplotlib', transform=ax.transAxes,
fontsize=40, color='gray', alpha=0.5,
ha='center', va='center', rotation='30')
plt.show()
.. image:: /gallery/text_labels_and_annotations/images/sphx_glr_watermark_text_001.png
:class: sphx-glr-single-img
------------
References
""""""""""
The use of the following functions, methods, classes and modules is shown
in this example:
.. code-block:: default
import matplotlib
matplotlib.figure.Figure.text
.. rst-class:: sphx-glr-script-out
Out:
.. code-block:: none
.. _sphx_glr_download_gallery_text_labels_and_annotations_watermark_text.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: watermark_text.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: watermark_text.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
Keywords: matplotlib code example, codex, python plot, pyplot
`Gallery generated by Sphinx-Gallery
`_