{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:31:27.385731Z", "iopub.status.busy": "2024-04-17T07:31:27.385466Z", "iopub.status.idle": "2024-04-17T07:31:27.708722Z", "shell.execute_reply": "2024-04-17T07:31:27.708294Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from lets_plot import *\n", "\n", "LetsPlot.setup_html()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Plotting means and error ranges.\n", "\n", "There are several ways to show error ranges on a plot. Among them are \n", "- *geom_errorbar*\n", "- *geom_crossbar*\n", "- *geom_linerange*\n", "- *geom_pointrange*" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:31:27.721963Z", "iopub.status.busy": "2024-04-17T07:31:27.721821Z", "iopub.status.idle": "2024-04-17T07:31:27.724176Z", "shell.execute_reply": "2024-04-17T07:31:27.723981Z" } }, "outputs": [], "source": [ "# This example was found at: www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)\n", "data = dict(\n", " supp = ['OJ', 'OJ', 'OJ', 'VC', 'VC', 'VC'],\n", " dose = [0.5, 1.0, 2.0, 0.5, 1.0, 2.0],\n", " length = [13.23, 22.70, 26.06, 7.98, 16.77, 26.14],\n", " len_min = [11.83, 21.2, 24.50, 4.24, 15.26, 23.35],\n", " len_max = [15.63, 24.9, 27.11, 10.72, 19.28, 28.93]\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:31:27.725326Z", "iopub.status.busy": "2024-04-17T07:31:27.725211Z", "iopub.status.idle": "2024-04-17T07:31:27.726721Z", "shell.execute_reply": "2024-04-17T07:31:27.726507Z" } }, "outputs": [], "source": [ "p = ggplot(data, aes(x='dose', color='supp'))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Error-bars with lines and points." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:31:27.727975Z", "iopub.status.busy": "2024-04-17T07:31:27.727808Z", "iopub.status.idle": "2024-04-17T07:31:27.759567Z", "shell.execute_reply": "2024-04-17T07:31:27.759316Z" } }, "outputs": [ { "data": { "text/html": [ " \n", " " ], "text/plain": [ "