.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/grouped_bar/plot_vertical_grouped_bar_rick.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_auto_examples_grouped_bar_plot_vertical_grouped_bar_rick.py: RICK Vertical Grouped Bar Chart ======================= Example of a vertical grouped bar chart. .. GENERATED FROM PYTHON SOURCE LINES 7-13 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt import pandas as pd import rick .. GENERATED FROM PYTHON SOURCE LINES 14-18 Data Collection ---------------- This Section grabs and formats the data. .. GENERATED FROM PYTHON SOURCE LINES 18-27 .. code-block:: Python np.random.seed(42) data = { 'Category': ['A', 'B', 'C', 'D'], 'Group1': np.random.randint(10, 50, 4), 'Group2': np.random.randint(20, 60, 4) } df = pd.DataFrame(data) df = df.set_index('Category') .. GENERATED FROM PYTHON SOURCE LINES 28-32 Vertical Grouped Bar Chart -------------------------- This Section uses the new vertical grouped bar chart function. .. GENERATED FROM PYTHON SOURCE LINES 32-41 .. code-block:: Python fig, ax = rick.charts.vertical_grouped_bar_chart( data=df, precision=1, xlab='Group', ylab='Category', percent=True, legend=['Group1', 'Group2']) plt.tight_layout() plt.show() .. image-sg:: /auto_examples/grouped_bar/images/sphx_glr_plot_vertical_grouped_bar_rick_001.png :alt: plot vertical grouped bar rick :srcset: /auto_examples/grouped_bar/images/sphx_glr_plot_vertical_grouped_bar_rick_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.423 seconds) .. _sphx_glr_download_auto_examples_grouped_bar_plot_vertical_grouped_bar_rick.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_vertical_grouped_bar_rick.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_vertical_grouped_bar_rick.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_