{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "401e7c71", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import pandas as pd\n", "\n", "from lets_plot import *\n", "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 2, "id": "bb8e3393", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(150, 5)\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
05.13.51.40.2setosa
14.93.01.40.2setosa
24.73.21.30.2setosa
34.63.11.50.2setosa
45.03.61.40.2setosa
\n", "
" ], "text/plain": [ " sepal_length sepal_width petal_length petal_width species\n", "0 5.1 3.5 1.4 0.2 setosa\n", "1 4.9 3.0 1.4 0.2 setosa\n", "2 4.7 3.2 1.3 0.2 setosa\n", "3 4.6 3.1 1.5 0.2 setosa\n", "4 5.0 3.6 1.4 0.2 setosa" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "iris_df = pd.read_csv(\"https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/iris.csv\")\n", "print(iris_df.shape)\n", "iris_df.head()" ] }, { "cell_type": "code", "execution_count": 3, "id": "acf0abe5", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "width, height = 400, 300\n", "bunch = GGBunch()\n", "bunch.add_plot(ggplot(iris_df, aes(\"species\", \"sepal_length\")) + \\\n", " geom_violin(trim=True) + \\\n", " ggtitle(\"trim=True (default)\"),\n", " 0, 0, width, height)\n", "bunch.add_plot(ggplot(iris_df, aes(\"species\", \"sepal_length\")) + \\\n", " geom_violin(trim=False, tails_cutoff=1) + \\\n", " ggtitle(\"trim=False, tails_cutoff=1\"),\n", " width, 0, width, height)\n", "bunch.add_plot(ggplot(iris_df, aes(\"species\", \"sepal_length\")) + \\\n", " geom_violin(trim=False, tails_cutoff=2) + \\\n", " ggtitle(\"trim=False, tails_cutoff=2\"),\n", " 0, height, width, height)\n", "bunch.add_plot(ggplot(iris_df, aes(\"species\", \"sepal_length\")) + \\\n", " geom_violin(trim=False, tails_cutoff=3) + \\\n", " ggtitle(\"trim=False, tails_cutoff=3 (default)\"),\n", " width, height, width, height)\n", "bunch.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.8.15" } }, "nbformat": 4, "nbformat_minor": 5 }