{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "5ad691ef-aacf-42ba-8348-635584136c0d", "metadata": { "execution": { "iopub.execute_input": "2024-04-26T12:20:49.638584Z", "iopub.status.busy": "2024-04-26T12:20:49.638584Z", "iopub.status.idle": "2024-04-26T12:20:50.644838Z", "shell.execute_reply": "2024-04-26T12:20:50.644838Z" } }, "outputs": [], "source": [ "from math import sqrt\n", "\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "6a0e740c-8b41-432c-9577-3d99b2a67583", "metadata": { "execution": { "iopub.execute_input": "2024-04-26T12:20:50.644838Z", "iopub.status.busy": "2024-04-26T12:20:50.644838Z", "iopub.status.idle": "2024-04-26T12:20:50.660465Z", "shell.execute_reply": "2024-04-26T12:20:50.660465Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "dc317cd6-6edf-4c59-9133-3ab25ab3a079", "metadata": { "execution": { "iopub.execute_input": "2024-04-26T12:20:50.660465Z", "iopub.status.busy": "2024-04-26T12:20:50.660465Z", "iopub.status.idle": "2024-04-26T12:20:50.676084Z", "shell.execute_reply": "2024-04-26T12:20:50.676084Z" } }, "outputs": [], "source": [ "r = .5\n", "h = r * sqrt(3)/2\n", "sets_data = {\n", " 'x': [0, r, r/2],\n", " 'y': [0, 0, h],\n", " 'size': [2*r, 2*r, 2*r],\n", " 'color': ['#e24462', '#306998', '#ffe873'],\n", "}\n", "texts_data = {\n", " 'x': [-r/2, r + r/2, r/2, r/2, -r/8, r + r/8, r/2],\n", " 'y': [-r/4, -r/4, h + r/2, -3*r/8, 5*r/8, 5*r/8, 5*r/16],\n", " 'text': [\"Kotlin\", \"Geospatial\\nVisualization\", \"Grammar\\nof\\nGraphics\", \"ArcGIS\", \"Kandy\", \"ggmap\", \"Lets-Plot\"],\n", " 'size': [.4*r]*7,\n", "}" ] }, { "cell_type": "code", "execution_count": 4, "id": "6613d60d-0c7b-47b1-a4e4-5e4710642ae7", "metadata": { "execution": { "iopub.execute_input": "2024-04-26T12:20:50.676084Z", "iopub.status.busy": "2024-04-26T12:20:50.676084Z", "iopub.status.idle": "2024-04-26T12:20:50.802300Z", "shell.execute_reply": "2024-04-26T12:20:50.802300Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ggplot() + \\\n", " geom_point(aes('x', 'y', size='size', fill='color'), \\\n", " data=sets_data, size_unit='x', \\\n", " shape=21, alpha=.5, color='black', \\\n", " tooltips='none') + \\\n", " geom_text(aes('x', 'y', label='text', size='size'), \\\n", " data=texts_data, size_unit='x') + \\\n", " scale_size_identity() + scale_fill_identity() + \\\n", " xlim(-r, 2*r) + ylim(-r, h + r) + \\\n", " coord_fixed() + \\\n", " ggsize(600, 600) + \\\n", " theme_void()" ] } ], "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 }