{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Tooltip Customization\n", "\n", "A few examples of tooltip configuring in *Lets-Plot* via the 'tooltips' parameter and 'theme()' function. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-08-23T10:32:19.806412Z", "iopub.status.busy": "2024-08-23T10:32:19.806290Z", "iopub.status.idle": "2024-08-23T10:32:20.129577Z", "shell.execute_reply": "2024-08-23T10:32:20.129244Z" } }, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2024-08-23T10:32:20.131172Z", "iopub.status.busy": "2024-08-23T10:32:20.131045Z", "iopub.status.idle": "2024-08-23T10:32:20.133129Z", "shell.execute_reply": "2024-08-23T10:32:20.132951Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2024-08-23T10:32:20.146656Z", "iopub.status.busy": "2024-08-23T10:32:20.146551Z", "iopub.status.idle": "2024-08-23T10:32:20.280476Z", "shell.execute_reply": "2024-08-23T10:32:20.280161Z" } }, "outputs": [], "source": [ "# Load mpg dataset.\n", "mpg_df = pd.read_csv(\"https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2024-08-23T10:32:20.281795Z", "iopub.status.busy": "2024-08-23T10:32:20.281696Z", "iopub.status.idle": "2024-08-23T10:32:20.284046Z", "shell.execute_reply": "2024-08-23T10:32:20.283732Z" } }, "outputs": [], "source": [ "p = (ggplot(mpg_df, aes(x='displ', y='cty', fill='drv', size='hwy'))\n", " + scale_size(range=[5, 15], breaks=[15, 40])\n", " + ggsize(600, 350)\n", " ) " ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2024-08-23T10:32:20.285296Z", "iopub.status.busy": "2024-08-23T10:32:20.285129Z", "iopub.status.idle": "2024-08-23T10:32:20.317917Z", "shell.execute_reply": "2024-08-23T10:32:20.317612Z" } }, "outputs": [ { "data": { "text/html": [ " \n", " " ], "text/plain": [ "