{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "confident-catalyst", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "DataFrame: rowsCount = 3, columnsCount = 12
\n", " \n", " \n", " " ] }, "execution_count": 3, "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": 4, "id": "vital-amendment", "metadata": {}, "outputs": [], "source": [ "val p = letsPlot(mpg.toMap()) + theme(axisTitleX=\"blank\")" ] }, { "cell_type": "code", "execution_count": 5, "id": "exotic-diagnosis", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "val boxPlot = p + \n", " geomBoxplot(color=\"#579673\", fill=\"#9AC0B3\", size=1.5) {\n", " x = asDiscrete(\"class\", order=1, orderBy=\"..middle..\")\n", " y = \"hwy\" \n", " } + \n", " ggsize(750, 300)\n", " \n", "boxPlot + ggtitle(\"Default\") " ] }, { "cell_type": "code", "execution_count": 6, "id": "touched-bicycle", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "boxPlot + ggtitle(\"Flipped\") + coordFlip()" ] }, { "cell_type": "code", "execution_count": 7, "id": "egyptian-speech", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "val barPlot = p + \n", " geomBar(size=1.5, alpha=0.7, width=0.7) {\n", " x = asDiscrete(\"manufacturer\", orderBy=\"..count..\")\n", " fill = \"class\"\n", " color = \"class\"\n", " } +\n", " ggsize(800, 300)\n", " \n", "barPlot + ggtitle(\"Default\")" ] }, { "cell_type": "code", "execution_count": 8, "id": "major-royal", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "barPlot + ggtitle(\"Flipped\") + coordFlip()" ] } ], "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 }