{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import hvplot.pandas # noqa" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`errorbars` are most helpful when overlayed with other plot types. To do this we'll use the `*` operator." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from bokeh.sampledata import perceptions\n", "\n", "data = perceptions.numberly.describe().transpose().sort_values('mean')\n", "data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First we'll use just one column to set the size of the errorbars around 'mean'." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data.hvplot.scatter(y='mean', ylabel='amount') * data.hvplot.errorbars(y='mean', yerr1='std')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then we'll use two columns. Remember that these are not the absolute placements of the ends of the bars, but the distance from the center." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data['yerr1'] = data['mean'] - data['min']\n", "data['yerr2'] = data['max'] - data['mean']\n", "data.hvplot.scatter(y='mean', ylabel='amount') * data.hvplot.errorbars(y='mean', yerr1='yerr1', yerr2='yerr2')" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 2 }