{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "b1f7c080-7fb0-428b-918e-04c4a65cfd36", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "\n", "from lets_plot import *\n", "from lets_plot.plot.coord import coord_polar" ] }, { "cell_type": "code", "execution_count": 2, "id": "eebabc41-5de3-44ae-b0e8-ec30de4c94e1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "markdown", "id": "bc520db3-bdee-4a28-9c32-d15874029531", "metadata": {}, "source": [ "##### Util for `PlotSpecDebugger.kt`" ] }, { "cell_type": "code", "execution_count": 3, "id": "d493053b-3a9a-4409-97fe-57be18f9dac6", "metadata": {}, "outputs": [], "source": [ "def dump_plot(plot, display=False):\n", " import json\n", "\n", " try:\n", " import clipboard\n", " except:\n", " clipboard = None\n", " \n", " from lets_plot._type_utils import standardize_dict\n", " \n", " plot_dict = standardize_dict(plot.as_dict())\n", " plot_json = json.dumps(plot_dict, indent=2)\n", " \n", " if clipboard:\n", " clipboard.copy('')\n", " clipboard.copy(str(plot_json))\n", " else:\n", " if display is None:\n", " display = True\n", "\n", " return plot" ] }, { "cell_type": "markdown", "id": "ab190a94-9770-4c6b-9bb6-caaf120e60a9", "metadata": {}, "source": [ "##### Data:" ] }, { "cell_type": "code", "execution_count": 4, "id": "a258b6d0-767b-4684-bcbf-4dc6fba6126f", "metadata": {}, "outputs": [], "source": [ "subj_short = ['CS', 'Math', 'Phys', 'Chem', 'Bio']\n", "subj = ['Computer Science', 'Mathematics', 'Physic', 'Chemistry', 'Biology']\n", "john = {\n", " 'subj_short': subj_short,\n", " 'subj': subj,\n", " 'subj_id': [1, 2, 3, 4, 5],\n", " 'student': ['John'] * 5,\n", " 'score': [19, 15, 18, 12, 9]\n", "}\n", "\n", "bob = {\n", " 'subj_short': subj_short,\n", " 'subj': subj,\n", " 'subj_id': [1, 2, 3, 4, 5],\n", " 'student': ['Bob'] * 5,\n", " 'score': [7, 18, 10, 18, 19]\n", "}\n", "\n", "def merge(dest, other):\n", " for k, v in other.items():\n", " list = dest.get(k, [])\n", " list.extend(v)\n", " list.append(v[0]) # close path\n", " dest[k] = list\n", "\n", "\n", "radar_df = {}\n", "merge(radar_df, john)\n", "merge(radar_df, bob)" ] }, { "cell_type": "markdown", "id": "1581c9c7-d23d-4b91-a530-26d521368c7b", "metadata": {}, "source": [ "### Minimal radar plot" ] }, { "cell_type": "code", "execution_count": 5, "id": "e0fcea18-3b15-4c8c-9e64-dc879390ff7d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ], "text/plain": [ "