{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Demonstration of using a custom color list with `donut_plot_with_subgroups_from_dataframe.py`\n", "\n", "Demonstrating use of `donut_plot_with_subgroups_from_dataframe.py` with a custom color list when using the imported script in a Jupyter notebook.\n", "\n", "The same approach can be used with the two related scripts `donut_plot_with_total_summary_and_subgroups_from_dataframe.py` and `donut_plot_with_total_binary_summary_and_binary_state_subgroups.py` and this is covered at the bottom of this notebook.\n", "\n", "This builds on the demonstration [here](index.ipynb) and so you may want to look at that first if you are not familiar with the script `donut_plot_with_subgroups_from_dataframe.py` first. And also see [here](https://github.com/fomightez/donut_plots_with_subgroups) for more information.\n", "\n", "In addition to this demonstration page, there are several other demonstration pages:\n", "\n", "- [Demonstrate the full-featured script to make a single donut plot with subgroups](index.ipynb)\n", "- [Demonstrate the basics](demo_basics_from_df.ipynb)\n", "- [Demonstrate a full-featured script that plots a summary for the subgroups in addition to the donut plot with subgroups](demo_summary_subgroups.ipynb)\n", "- [Demonstrate a full-featured script that plots a summary for binary data in addition to the donut plot with the binary group broken down by a group](demo_summary_binary.ipynb)\n", "\n", "\n", "-----\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Preparation\n", "\n", "Let's get the script to insure it is here. (It won't do antyhing if the script is already retrieved.)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "file_needed = \"donut_plot_with_subgroups_from_dataframe.py\"\n", "if not os.path.isfile(file_needed):\n", " !curl -OL https://raw.githubusercontent.com/fomightez/donut_plots_with_subgroups/master/donut_plot_with_subgroups_from_dataframe.py" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Define a demo dataframe will be used for input data." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | group | \n", "subgroup | \n", "sub-subgroup | \n", "
---|---|---|---|
0 | \n", "A | \n", "1 | \n", "frizzled | \n", "
1 | \n", "A | \n", "1 | \n", "lethargic | \n", "
2 | \n", "A | \n", "1 | \n", "polythene | \n", "
3 | \n", "A | \n", "1 | \n", "epic | \n", "
4 | \n", "A | \n", "2 | \n", "frizzled | \n", "