{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "dab12aad", "metadata": {}, "outputs": [], "source": [ "from lets_plot import *\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "ce2508c2", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "91ee237b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dat = dict(\n", " animal = [\"cow\", \"mouse\", \"horse\"],\n", " weight_l = [ 20, 5, 30 ],\n", " weight_h = [ 27, 10, 39 ],\n", " weight_m = [ 25, 7, 32 ],\n", ")\n", "\n", "(ggplot(dat)\n", " + geom_crossbar(aes(x=\"animal\", y=\"weight_m\", ymin=\"weight_l\", ymax=\"weight_h\"))\n", " + theme_bw()\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "id": "c3e8ba67", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ggplot(dat)\n", " + geom_crossbar(aes(y=\"animal\", x=\"weight_m\", xmin=\"weight_l\", xmax=\"weight_h\"))\n", " + theme_bw()\n", ")" ] }, { "cell_type": "code", "execution_count": 5, "id": "14fe473a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ggplot()\n", " + geom_crossbar(y=7, ymin=5, ymax=10)\n", " + theme_bw()\n", ")" ] }, { "cell_type": "code", "execution_count": 6, "id": "a3548b74", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ggplot()\n", " + geom_crossbar(x=7, xmin=5, xmax=10)\n", " + theme_bw()\n", ")" ] }, { "cell_type": "markdown", "id": "e6df0119", "metadata": {}, "source": [ "### Undefined Y" ] }, { "cell_type": "code", "execution_count": 7, "id": "917c498b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ggplot(dat)\n", " + geom_crossbar(aes(x=\"animal\", ymin=\"weight_l\", ymax=\"weight_h\"))\n", " + theme_bw()\n", ")" ] }, { "cell_type": "code", "execution_count": 8, "id": "d25f7805", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ggplot()\n", " + geom_crossbar(ymin=5, ymax=10)\n", " + theme_bw()\n", ")" ] }, { "cell_type": "markdown", "id": "f8f1935e", "metadata": {}, "source": [ "### Undefined X" ] }, { "cell_type": "code", "execution_count": 9, "id": "c9e02137", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ggplot(dat)\n", " + geom_crossbar(aes(y=\"animal\", xmin=\"weight_l\", xmax=\"weight_h\"))\n", " + theme_bw()\n", ")" ] }, { "cell_type": "code", "execution_count": 10, "id": "7d9489aa", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ggplot()\n", " + geom_crossbar(xmin=5, xmax=10)\n", " + theme_bw()\n", ")" ] }, { "cell_type": "markdown", "id": "a3ba6576", "metadata": {}, "source": [ "## Box-plot : no X" ] }, { "cell_type": "code", "execution_count": 11, "id": "d4e59d58", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ggplot()\n", " + geom_boxplot(middle=8, lower=6, upper=9, ymin=5, ymax=10)\n", " + theme_bw()\n", ")" ] }, { "cell_type": "markdown", "id": "c5744d3e", "metadata": {}, "source": [ "## Box-plot : no Y" ] }, { "cell_type": "code", "execution_count": 12, "id": "c4784869", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ggplot()\n", " + geom_boxplot(middle=8, lower=6, upper=9, ymin=5, ymax=10, orientation=\"y\")\n", " + theme_bw()\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10" } }, "nbformat": 4, "nbformat_minor": 5 }