{ "cells": [ { "cell_type": "markdown", "id": "38d33391", "metadata": {}, "source": [ "# `stroke` aesthetic\n", "\n", "Affects the thickness of the point boundaries (in case the given shape has a boundary).\n", "\n", "Available for the following geometries: `geomPoint()`, `geomJitter()`, `geomQQ()`, `geomQQ2()`, `geomPointRange()`, `geomDotplot()`, `geomYDotplot()`." ] }, { "cell_type": "code", "execution_count": 1, "id": "2414e10d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%useLatestDescriptors\n", "%use lets-plot" ] }, { "cell_type": "code", "execution_count": 2, "id": "49a95a58", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Lets-Plot Kotlin API v.4.4.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.3.2.0." ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LetsPlot.getInfo()" ] }, { "cell_type": "code", "execution_count": 3, "id": "7795fa94", "metadata": {}, "outputs": [], "source": [ "val n = 26\n", "val data1 = mapOf(\n", " \"x\" to List(4) { (0..6) }.flatten().take(n),\n", " \"y\" to (3 downTo 0).flatMap { y -> List(7) { y } }.take(n),\n", " \"shape\" to (0 until n).toList()\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "id": "1b7975fc", "metadata": {}, "outputs": [], "source": [ "val p1 = letsPlot(data1) { x = \"x\"; y = \"y\" } + \n", " scaleShapeIdentity() + \n", " lims(x = -1 to 7, y = -1 to 4) +\n", " theme().legendPositionNone()" ] }, { "cell_type": "markdown", "id": "788ed3dd", "metadata": {}, "source": [ "#### 1. Default Stroke" ] }, { "cell_type": "code", "execution_count": 5, "id": "fbbf5d7f", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p1 + geomPoint(size=12, color=\"#54278f\", fill=\"#dd1c77\") { shape = \"shape\" }" ] }, { "cell_type": "markdown", "id": "ec91cc9b", "metadata": {}, "source": [ "#### 2. Increased Stroke" ] }, { "cell_type": "code", "execution_count": 6, "id": "57c5e75c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p1 + geomPoint(size=12, stroke=8, color=\"#54278f\", fill=\"#dd1c77\") { shape = \"shape\" }" ] }, { "cell_type": "markdown", "id": "a80e77a8", "metadata": {}, "source": [ "#### 3. Stroke Scales" ] }, { "cell_type": "code", "execution_count": 7, "id": "cd516883", "metadata": {}, "outputs": [], "source": [ "val data2 = mapOf(\n", " \"x\" to listOf(0, 1, 2),\n", " \"y\" to listOf(0, 0, 0),\n", " \"stroke\" to listOf(4, 16, 8)\n", ")" ] }, { "cell_type": "code", "execution_count": 8, "id": "65ac3c1e", "metadata": {}, "outputs": [], "source": [ "val p2 = letsPlot(data2) { x = \"x\"; y = \"y\" } +\n", " geomPoint(size = 12, shape = 21, color = \"#54278f\", fill = \"#dd1c77\") { stroke = \"stroke\" }" ] }, { "cell_type": "code", "execution_count": 9, "id": "86c86e91", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gggrid(\n", " listOf(\n", " p2 + ggtitle(\"Default scale\"),\n", " p2 + scaleStroke(range = 2 to 4) + ggtitle(\"scaleStroke()\"),\n", " p2 + scaleStrokeIdentity() + ggtitle(\"scaleStrokeIdentity()\"),\n", " ),\n", " ncol = 2\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.8.20" } }, "nbformat": 4, "nbformat_minor": 5 }