A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mpl-visual-context.readthedocs.io/en/latest/examples/image_effect/test_violin.html below:

Website Navigation


Violing Chart w/ ImageEffects — mpl_visual_context 0.9.3 documentation

Violing Chart w/ ImageEffects
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,
                   hue='day', palette='deep',
                   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()

Total running time of the script: (0 minutes 0.102 seconds)

Gallery generated by Sphinx-Gallery


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4