.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "plot_types/statistical/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_plot_types_statistical_violin.py: Violin Plot =========== Distribution comparison using :class:`ViolinPlot`. .. GENERATED FROM PYTHON SOURCE LINES 7-36 .. image-sg:: /plot_types/statistical/images/sphx_glr_violin_001.png :alt: Violin Plot :srcset: /plot_types/statistical/images/sphx_glr_violin_001.png :class: sphx-glr-single-img .. code-block:: Python import numpy as np from emcpy.plots.plots import ViolinPlot from emcpy.plots.create_plots import CreatePlot, CreateFigure rng = np.random.default_rng(0) n_samples = 400 groups = [rng.normal(0.0, 1.0, n_samples), rng.normal(0.5, 0.8, n_samples), rng.normal(-0.3, 1.2, n_samples)] p = CreatePlot() layers = [] vio = ViolinPlot(groups) vio.showmedians = True vio.alpha = 0.8 layers.append(vio) p.plot_layers = layers p.add_title("Violin Plot") p.add_ylabel("value") p.set_xticks([0, 1, 2]) p.set_xticklabels(["A", "B", "C"]) fig = CreateFigure(1, 1, figsize=(7.2, 4)) fig.plot_list = [p] fig.create_figure() fig.tight_layout() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.068 seconds) .. _sphx_glr_download_plot_types_statistical_violin.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: violin.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: violin.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: violin.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_