.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/path_effects/test_pe_container.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_pe_container.py: ===================== PathEffects Container ===================== .. GENERATED FROM PYTHON SOURCE LINES 7-56 .. image-sg:: /examples/path_effects/images/sphx_glr_test_pe_container_001.png :alt: test pe container :srcset: /examples/path_effects/images/sphx_glr_test_pe_container_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import seaborn as sns from mpl_visual_context.patheffects import ( HLSModify, ColorMatrix as CMS, PathEffectsContainer, ) def test(): df_peng = sns.load_dataset("penguins") # registry of path_effects registry = dict( bright=[HLSModify(l="-50%")], bright_gray=[HLSModify(l="-50%") | CMS("grayscale")], ) fig, axl = plt.subplots(1, 3, figsize=(11, 3), constrained_layout=True, clear=True) ax = axl[0] sns.countplot(y="species", data=df_peng, ax=ax) # second axes; with brighter color, oe directly from the registry ax = axl[1] sns.countplot(y="species", data=df_peng, ax=ax) pe = registry["bright"] for p in ax.patches[:2]: p.set_path_effects(pe) # second axes; with brighter+gray color, using the pe container. ax = axl[2] sns.countplot(y="species", data=df_peng, ax=ax) pe = PathEffectsContainer(registry) for p in ax.patches[:2]: p.set_path_effects(pe) pe.use("bright_gray") plt.show() if __name__ == '__main__': test() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.207 seconds) .. _sphx_glr_download_examples_path_effects_test_pe_container.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: test_pe_container.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: test_pe_container.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: test_pe_container.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_