.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/path_effects/test_bbox_alpha_path_effect.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_bbox_alpha_path_effect.py: ==================== Violing Chart ==================== .. GENERATED FROM PYTHON SOURCE LINES 7-43 .. image-sg:: /examples/path_effects/images/sphx_glr_test_bbox_alpha_path_effect_001.png :alt: test bbox alpha path effect :srcset: /examples/path_effects/images/sphx_glr_test_bbox_alpha_path_effect_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np import matplotlib.pyplot as plt import seaborn seaborn.set() tips = seaborn.load_dataset("tips") fig, ax = plt.subplots(num=1, clear=True) seaborn.violinplot(x='day', y='tip', data=tips, ax=ax, hue='day', palette='deep') from matplotlib.collections import PolyCollection # from mpl_visual_context.patheffects_image_bbox import ( # BboxAlphaPathEffect, # ColorBboxAlpha, # ) import mpl_visual_context.patheffects as pe colls = [p for p in ax.collections if isinstance(p, PolyCollection)] from mpl_visual_context.patheffects_base import AbstractPathEffect from matplotlib.transforms import BboxTransformTo, Bbox, TransformedPath from mpl_visual_context.patheffects_image_box import AlphaGradient pe_list = [ AlphaGradient("0.7 > 0.1 > 0.7"), (pe.StrokeColorFromFillColor() | pe.HLSModify(l="-50%") | pe.StrokeOnly()), ] for x, coll in enumerate(colls): coll.set_path_effects(pe_list) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.129 seconds) .. _sphx_glr_download_examples_path_effects_test_bbox_alpha_path_effect.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: test_bbox_alpha_path_effect.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: test_bbox_alpha_path_effect.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: test_bbox_alpha_path_effect.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_