{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "27c415bc-19bd-4ab4-80c9-efdb5d33c03a", "metadata": { "execution": { "iopub.execute_input": "2025-07-17T17:09:22.390249Z", "iopub.status.busy": "2025-07-17T17:09:22.390072Z", "iopub.status.idle": "2025-07-17T17:09:22.393150Z", "shell.execute_reply": "2025-07-17T17:09:22.392965Z" } }, "outputs": [], "source": [ "import numpy as np\n", "\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "771f62b1-b4d8-48e3-b2cb-2fae1c4177a8", "metadata": { "execution": { "iopub.execute_input": "2025-07-17T17:09:22.394087Z", "iopub.status.busy": "2025-07-17T17:09:22.393938Z", "iopub.status.idle": "2025-07-17T17:09:22.395719Z", "shell.execute_reply": "2025-07-17T17:09:22.395533Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "a048d094-8294-47ac-98d4-920c2c441f64", "metadata": { "execution": { "iopub.execute_input": "2025-07-17T17:09:22.396551Z", "iopub.status.busy": "2025-07-17T17:09:22.396479Z", "iopub.status.idle": "2025-07-17T17:09:22.420546Z", "shell.execute_reply": "2025-07-17T17:09:22.420248Z" } }, "outputs": [], "source": [ "np.random.seed(0) \n", "N = 200\n", "noise = dict(\n", " x = np.random.uniform(0, 200, N),\n", " y = np.random.uniform(100, 400, N),\n", " size = np.random.uniform(0.1, 2, N) \n", ")\n", "backdrop = geom_point(aes(\"x\", \"y\", size=\"size\"), data=noise, tooltips='none') " ] }, { "cell_type": "code", "execution_count": 4, "id": "87412abd-01b8-4295-969d-cf967fbbc5fb", "metadata": { "execution": { "iopub.execute_input": "2025-07-17T17:09:22.421675Z", "iopub.status.busy": "2025-07-17T17:09:22.421453Z", "iopub.status.idle": "2025-07-17T17:09:22.424288Z", "shell.execute_reply": "2025-07-17T17:09:22.424109Z" } }, "outputs": [], "source": [ "items = [\n", " dict(\n", " name=\"Lets-Plot\\nMultiplatform\",\n", " documentation_url=\"https://lets-plot.org\",\n", " sources_url=\"https://github.com/JetBrains/lets-plot\",\n", " x=0, y=0, size=14, shape=16, angle=0\n", " ),\n", " dict(\n", " name=\"Lets-Plot\\nfor Python\",\n", " documentation_url=\"https://lets-plot.org/kotlin/get-started.html\",\n", " sources_url=\"https://github.com/JetBrains/lets-plot-kotlin\",\n", " x=130, y=150, size=9, shape=15, angle=15\n", " ),\n", " dict(\n", " name=\"Lets-Plot\\nfor Kotlin\",\n", " documentation_url=\"https://lets-plot.org/kotlin/get-started.html\",\n", " sources_url=\"https://github.com/JetBrains/lets-plot-kotlin\",\n", " x=200, y=200, size=7, shape=15, angle=-15\n", " ),\n", " dict(\n", " name=\"Lets-Plot\\nCompose Multiplatform\",\n", " documentation_url=\"https://github.com/JetBrains/lets-plot-skia\",\n", " sources_url=\"https://github.com/JetBrains/lets-plot-skia\",\n", " x=80, y=250, size=7, shape=15, angle=30\n", " ),\n", " dict(\n", " name=\"Geocoding\",\n", " documentation_url=\"https://lets-plot.org/python/pages/geocoding.html\",\n", " sources_url=\"https://github.com/JetBrains/lets-plot\",\n", " x=70, y=320, size=7, shape=17, angle=0\n", " ),\n", " dict(\n", " name=\"Kandy\",\n", " documentation_url=\"https://kotlin.github.io/kandy/welcome.html\",\n", " sources_url=\"https://github.com/Kotlin/kandy\",\n", " x=195.0, y=150.0, size=4.0, shape=16, angle=0.0\n", " ),\n", "]\n", "\n", "map_to = lambda key: [item[key] for item in items]\n", "data = dict(name=map_to(\"name\"),\n", " documentation_url=map_to(\"documentation_url\"),\n", " sources_url=map_to(\"sources_url\"),\n", " x=map_to(\"x\"),\n", " y=map_to(\"y\"),\n", " size=map_to(\"size\"),\n", " shape=map_to(\"shape\"),\n", " angle=map_to(\"angle\"))" ] }, { "cell_type": "code", "execution_count": 5, "id": "abc5e82f-06f0-4fa0-9dfb-f244e1d8e45b", "metadata": { "execution": { "iopub.execute_input": "2025-07-17T17:09:22.425196Z", "iopub.status.busy": "2025-07-17T17:09:22.425034Z", "iopub.status.idle": "2025-07-17T17:09:22.436633Z", "shell.execute_reply": "2025-07-17T17:09:22.436455Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(ggplot(data) + backdrop\n", " + geom_point(aes(\"x\", \"y\", size=\"size\", shape=\"shape\", angle=\"angle\", color=\"name\"), show_legend=False,\n", " tooltips=layer_tooltips().title(\"@name\")\n", " .line(\"Links: docs, \"\n", " \"sources\"))\n", " # Kandy orbit\n", " + geom_point(x=200, y=200, size=37, shape=1, stroke=.07)\n", " # Kandy stick\n", " + geom_spoke(x=195, y=150, angle=-3.14/2/1.05, radius=30, size=1, color=\"rgb(255,255,97)\")\n", " # Guide\n", " + geom_text(x=50, y=250, size=12,\n", " label=\"Hover, then click\\nto freeze \"\n", " \"the tooltip.\\nClick links\\nto navigate.\")\n", " + geom_segment(x=70, y=250, xend=0, yend=0,\n", " size_start=150, size_end=20,\n", " arrow=arrow(type='open', angle=40))\n", " + scale_y_continuous(breaks=[150, 200, 250, 320])\n", " + scale_shape_identity() + scale_size_identity()\n", " + coord_polar()\n", " + ylim(0, 400) + ggsize(800, 800)\n", " + labs(title='The Observable LP-verse',\n", " subtitle='Latest news.',\n", " caption='User stories.')\n", " + theme(plot_title=element_text(size=25, face=\"bold\", hjust=0.5),\n", " plot_subtitle=element_text(hjust=0.5),\n", " plot_margin=[40, 0, 0],\n", " axis_title='blank',\n", " axis_text='blank',\n", " axis_ticks='blank',\n", " panel_grid='blank', \n", " panel_grid_major_y=element_line(size=3, linetype='dotted'))\n", " + flavor_high_contrast_dark()\n", ")" ] } ], "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.10.13" } }, "nbformat": 4, "nbformat_minor": 5 }