.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "recipes/pivoting/plot_pivot_chart_all_categories.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_recipes_pivoting_plot_pivot_chart_all_categories.py: Pivot Charts across All Categories --------------------------- If plotting a pivoted chart where all categories should be included, the ``include_all_categories`` flag can be used. When this flag is enabled, all categories within the ``pivot_column_name`` will have as series dynamically generated based on the specified ``series``. - Each series will use a different color automatically, other formatting settings will be inherited from the ``series`` defined in the chart function - The formatting options will be limited, so this should be used for charts where customizations per series are not necessary - Series can still be stacked using the ``is_stacked`` flag - Categories will be sorted on the legend in ascending order, but can be sorted on another column via the ``category_sort_column_name`` argument .. GENERATED FROM PYTHON SOURCE LINES 14-38 .. raw:: html


.. code-block:: Python import pandas as pd from visualization_toolkit.helpers.plotly import chart, axis, series fig = chart( pdf, x_axis=axis(column_name="fiscal_qy", label="Fiscal Quarter"), y1_axis=axis(label="Downloads", axis_type="number", axis_min=0), chart_series=[ series( column_name="ios_dl_idx", mode="bar", is_stacked=True, pivot_column_name="region", include_all_categories=True, # sort categories by total downloads using the ios_dl_idx column # in descending order (the "-" indicates descending) category_sort_column_name="-ios_dl_idx", ), ], ) fig .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.031 seconds) .. _sphx_glr_download_recipes_pivoting_plot_pivot_chart_all_categories.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_pivot_chart_all_categories.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_pivot_chart_all_categories.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_pivot_chart_all_categories.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_