{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "brief-batch", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%useLatestDescriptors\n", "%use lets-plot\n", "// %use krangl" ] }, { "cell_type": "code", "execution_count": 2, "id": "suffering-yukon", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Lets-Plot Kotlin API v.3.3.0. Frontend: Notebook with dynamically loaded JS. Lets-Plot JS v.2.4.0." ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "LetsPlot.getInfo()" ] }, { "cell_type": "code", "execution_count": 3, "id": "scheduled-correction", "metadata": {}, "outputs": [], "source": [ "%use krangl" ] }, { "cell_type": "code", "execution_count": 4, "id": "incredible-dictionary", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
manufacturermodeldisplyearcyltransdrvctyhwyflclass
1audia41.819994auto(l5)f1829pcompact
2audia41.819994manual(m5)f2129pcompact
3audia42.020084manual(m6)f2031pcompact

Shape: 3 x 12. \n", "

" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "var mpg = DataFrame.readCSV(\"https://raw.githubusercontent.com/JetBrains/lets-plot-kotlin/master/docs/examples/data/mpg.csv\")\n", "mpg.head(3)\n" ] }, { "cell_type": "code", "execution_count": 5, "id": "twenty-coaching", "metadata": {}, "outputs": [], "source": [ "val p = letsPlot(mpg.toMap()) + geomPoint { x = \"cty\"; y = \"hwy\"}" ] }, { "cell_type": "code", "execution_count": 6, "id": "buried-calculator", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "val (w, h) = 400 to 300\n", "val e_rect = elementRect(color=\"#9e9eff\", fill=\"#f0f8ff\", size=8)\n", "\n", "// compare theme parameters: panelBackground and panelBorder.\n", "// Note: panelBorder ignores the \"fill\" setting.\n", "\n", "val bunch = GGBunch()\n", "bunch.addPlot(p + ggtitle(\"panel_background=e_rect\") + theme(panelBackground=e_rect), 0, 0, w, h)\n", "bunch.addPlot(p + ggtitle(\"panel_border=e_rect\") + theme(panelBorder=e_rect), w, 0, w, h)\n", "bunch" ] } ], "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.7.20-dev-1299" } }, "nbformat": 4, "nbformat_minor": 5 }