.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/path_effects/test_text_style.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_examples_path_effects_test_text_style.py: ==================== Text Styles ==================== .. GENERATED FROM PYTHON SOURCE LINES 7-75 .. image-sg:: /examples/path_effects/images/sphx_glr_test_text_style_001.png :alt: test text style :srcset: /examples/path_effects/images/sphx_glr_test_text_style_001.png :class: sphx-glr-single-img .. code-block:: Python from mpl_visual_context.patheffects_color import HLSModify, StrokeColorFromFillColor import matplotlib.pyplot as plt import mplcyberpunk # plt.style.use("cyberpunk") from mpl_visual_context import check_dark from mpl_visual_context.patheffects import ( GCModify, HLSaxb, Glow, StrokeColor, StrokeOnly, FillColor, FillOnly, ClipPathSelf, ) fig, ax = plt.subplots(num=1, clear=True, figsize=(10, 5)) invert_l = HLSaxb(l_ab=(-1, 1)) # invert the lightness pe_text_registry = { "shadow": [ GCModify(linewidth=1) | invert_l | Glow(alpha_line=10.0, diff_linewidth=0.0, offset=(3, -3)), FillOnly(), ], "glow": [ invert_l | Glow(), FillOnly(), GCModify(linewidth=1) | invert_l | StrokeOnly(), ], "engraved": [ ClipPathSelf() | GCModify(linewidth=1) | invert_l | Glow(alpha_line=1.0, diff_linewidth=0.5, offset=(3, -3)), GCModify(linewidth=0.5) | invert_l | StrokeOnly(), ], "neon": [invert_l | Glow(alpha_line=1), GCModify(linewidth=3) | StrokeOnly()], } if check_dark(ax.patch.get_fc()): text_color = "k" else: text_color = "w" for i, pe in enumerate(pe_text_registry.values()): t1 = ax.text( i + 0.5, 0.5, "M", size=80, color=text_color, weight="bold", va="center", ha="center", ) t1.set_path_effects(pe) ax.set_xlim(0, len(pe_text_registry)) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.069 seconds) .. _sphx_glr_download_examples_path_effects_test_text_style.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: test_text_style.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: test_text_style.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: test_text_style.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_