{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Stacked Barplot" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A function to conveniently plot stacked bar plots in matplotlib using pandas `DataFrame`s. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "> from mlxtend.general_plotting import category_scatter" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Overview" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A matplotlib convenience function for creating barplots from DataFrames where each sample is associated with several categories." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### References\n", "\n", "- -" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1 - Stacked Barplot from Pandas DataFrames" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | X1 | \n", "X2 | \n", "X3 | \n", "X4 | \n", "
---|---|---|---|---|
Sample1 | \n", "1.0 | \n", "2.0 | \n", "3.0 | \n", "4.0 | \n", "
Sample2 | \n", "1.4 | \n", "2.1 | \n", "2.9 | \n", "5.1 | \n", "
Sample3 | \n", "1.9 | \n", "2.2 | \n", "3.5 | \n", "4.1 | \n", "
Sample4 | \n", "1.4 | \n", "2.5 | \n", "3.5 | \n", "4.2 | \n", "