{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import hvplot.pandas # noqa" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`bar` can be used on dataframes with regular `Index` or `MultiIndex`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from bokeh.sampledata.autompg import autompg_clean as df\n", "\n", "table = df.groupby('yr').mean()\n", "table.head()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "table.hvplot.bar(y='mpg', height=500)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "table = df.groupby(['yr', 'origin']).mean()\n", "table.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "When mutiple axes are being used on the xaxis, plots can be stacked or unstacked." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "table.hvplot.bar(stacked=True, height=500, legend='top_left')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "table.hvplot.bar(stacked=False, height=500, rot=60)" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 4 }