{ "cells": [ { "cell_type": "markdown", "id": "16fde1b1", "metadata": {}, "source": [ "# `tailsCutoff` parameter for `geomViolin()`\n", "\n", "Parameter `tailsCutoff` extends domain of each violin if `trim=false`.\n", "\n", "Accepts float values, by default `tailsCutoff=3.0`." ] }, { "cell_type": "code", "execution_count": 1, "id": "ad5c532d", "metadata": { "execution": { "iopub.execute_input": "2024-08-23T11:03:07.235282Z", "iopub.status.busy": "2024-08-23T11:03:07.234205Z", "iopub.status.idle": "2024-08-23T11:03:09.937821Z", "shell.execute_reply": "2024-08-23T11:03:09.937599Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%useLatestDescriptors\n", "%use lets-plot\n", "%use dataframe" ] }, { "cell_type": "code", "execution_count": 2, "id": "9541ee62", "metadata": { "execution": { "iopub.execute_input": "2024-08-23T11:03:09.940228Z", "iopub.status.busy": "2024-08-23T11:03:09.939744Z", "iopub.status.idle": "2024-08-23T11:03:09.984958Z", "shell.execute_reply": "2024-08-23T11:03:09.984393Z" } }, "outputs": [ { "data": { "text/plain": [ "Lets-Plot Kotlin API v.4.7.2. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.4.3.2." ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LetsPlot.getInfo()" ] }, { "cell_type": "code", "execution_count": 3, "id": "f858a20f", "metadata": { "execution": { "iopub.execute_input": "2024-08-23T11:03:09.987373Z", "iopub.status.busy": "2024-08-23T11:03:09.986936Z", "iopub.status.idle": "2024-08-23T11:03:10.625378Z", "shell.execute_reply": "2024-08-23T11:03:10.625564Z" } }, "outputs": [ { "data": { "application/kotlindataframe+json": "{\"nrow\":5,\"ncol\":5,\"columns\":[\"sepal_length\",\"sepal_width\",\"petal_length\",\"petal_width\",\"species\"],\"kotlin_dataframe\":[{\"sepal_length\":5.1,\"sepal_width\":3.5,\"petal_length\":1.4,\"petal_width\":0.2,\"species\":\"setosa\"},{\"sepal_length\":4.9,\"sepal_width\":3.0,\"petal_length\":1.4,\"petal_width\":0.2,\"species\":\"setosa\"},{\"sepal_length\":4.7,\"sepal_width\":3.2,\"petal_length\":1.3,\"petal_width\":0.2,\"species\":\"setosa\"},{\"sepal_length\":4.6,\"sepal_width\":3.1,\"petal_length\":1.5,\"petal_width\":0.2,\"species\":\"setosa\"},{\"sepal_length\":5.0,\"sepal_width\":3.6,\"petal_length\":1.4,\"petal_width\":0.2,\"species\":\"setosa\"}]}", "text/html": [ " \n", " \n", " \n", " \n", " \n", "
\n", "\n", "

DataFrame: rowsCount = 5, columnsCount = 5

\n", "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
5.1000003.5000001.4000000.200000setosa
4.9000003.0000001.4000000.200000setosa
4.7000003.2000001.3000000.200000setosa
4.6000003.1000001.5000000.200000setosa
5.0000003.6000001.4000000.200000setosa
\n", " \n", " \n", " " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "val iris = DataFrame.readCSV(\"https://raw.githubusercontent.com/JetBrains/lets-plot-kotlin/master/docs/examples/data/iris.csv\")\n", "iris.head()\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "861f8412", "metadata": { "execution": { "iopub.execute_input": "2024-08-23T11:03:10.627812Z", "iopub.status.busy": "2024-08-23T11:03:10.627288Z", "iopub.status.idle": "2024-08-23T11:03:10.855072Z", "shell.execute_reply": "2024-08-23T11:03:10.855180Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "val p = letsPlot(iris.toMap()) { x = \"species\"; y = \"sepal_length\" }\n", "\n", "gggrid(\n", " plots = listOf(\n", " p + geomViolin(trim = true) + ggtitle(\"trim=true (default)\"),\n", " p + geomViolin(trim = false, tailsCutoff = 1) + ggtitle(\"trim=false, tailsCutoff=1\"),\n", " p + geomViolin(trim = false, tailsCutoff = 2) + ggtitle(\"trim=false, tailsCutoff=2\"),\n", " p + geomViolin(trim = false, tailsCutoff = 3) + ggtitle(\"trim=false, tailsCutoff=3 (default)\"),\n", " ),\n", " ncol = 2,\n", " cellWidth = 400,\n", " cellHeight = 300\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": "Kotlin", "language": "kotlin", "name": "kotlin" }, "language_info": { "codemirror_mode": "text/x-kotlin", "file_extension": ".kt", "mimetype": "text/x-kotlin", "name": "kotlin", "nbconvert_exporter": "", "pygments_lexer": "kotlin", "version": "1.9.23" } }, "nbformat": 4, "nbformat_minor": 5 }