{ "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-04-26T12:09:51.403631Z", "iopub.status.busy": "2024-04-26T12:09:51.403631Z", "iopub.status.idle": "2024-04-26T12:09:52.395965Z", "shell.execute_reply": "2024-04-26T12:09:52.395965Z" } }, "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-04-26T12:09:52.395965Z", "iopub.status.busy": "2024-04-26T12:09:52.395965Z", "iopub.status.idle": "2024-04-26T12:09:52.411678Z", "shell.execute_reply": "2024-04-26T12:09:52.411678Z" } }, "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-04-26T12:09:52.427294Z", "iopub.status.busy": "2024-04-26T12:09:52.427294Z", "iopub.status.idle": "2024-04-26T12:09:52.710582Z", "shell.execute_reply": "2024-04-26T12:09:52.710582Z" } }, "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-04-26T12:09:52.710582Z", "iopub.status.busy": "2024-04-26T12:09:52.710582Z", "iopub.status.idle": "2024-04-26T12:09:52.741973Z", "shell.execute_reply": "2024-04-26T12:09:52.741973Z" } }, "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-04-26T12:09:52.744576Z", "iopub.status.busy": "2024-04-26T12:09:52.744576Z", "iopub.status.idle": "2024-04-26T12:09:52.852071Z", "shell.execute_reply": "2024-04-26T12:09:52.852071Z" } }, "outputs": [ { "data": { "text/html": [ " \n", " " ], "text/plain": [ "