.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/image_effect/test_violin.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_image_effect_test_violin.py: ==================== Violing Chart w/ ImageEffects ==================== .. GENERATED FROM PYTHON SOURCE LINES 7-41 .. image-sg:: /examples/image_effect/images/sphx_glr_test_violin_001.png :alt: test violin :srcset: /examples/image_effect/images/sphx_glr_test_violin_001.png :class: sphx-glr-single-img .. code-block:: default 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) from matplotlib.collections import PolyCollection import mpl_visual_context.patheffects as pe import mpl_visual_context.image_effect as ie colls = [p for p in ax.collections if isinstance(p, PolyCollection)] shadow = pe.ImageEffect( ie.AlphaAxb((0.3, 0)) | ie.Pad(10) | ie.Fill("k") | ie.Dilation(3) | ie.Gaussian(4) | ie.Offset(3, -3) ) light = pe.ImageEffect(ie.LightSource(erosion_size=5, gaussian_size=5)) pe_list = [pe.FillOnly() | shadow, pe.FillOnly() | light] 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.285 seconds) .. _sphx_glr_download_examples_image_effect_test_violin.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: test_violin.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: test_violin.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_