{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Multi-line Labels in Legend\n", "\n", "The 'newline' character (`\\n`) now works as 'line break' in the legend text." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-03-26T14:31:35.570388Z", "iopub.status.busy": "2024-03-26T14:31:35.570305Z", "iopub.status.idle": "2024-03-26T14:31:35.893374Z", "shell.execute_reply": "2024-03-26T14:31:35.893026Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from lets_plot import *\n", "\n", "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2024-03-26T14:31:35.906267Z", "iopub.status.busy": "2024-03-26T14:31:35.906110Z", "iopub.status.idle": "2024-03-26T14:31:36.037827Z", "shell.execute_reply": "2024-03-26T14:31:36.037427Z" } }, "outputs": [], "source": [ "import pandas as pd\n", "\n", "mpg = pd.read_csv (\"https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2024-03-26T14:31:36.038984Z", "iopub.status.busy": "2024-03-26T14:31:36.038909Z", "iopub.status.idle": "2024-03-26T14:31:36.067180Z", "shell.execute_reply": "2024-03-26T14:31:36.066900Z" } }, "outputs": [], "source": [ "p = ggplot(mpg, aes(\"displ\", \"hwy\")) + geom_point(aes(color=\"cty\", shape=\"drv\"), size=5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Legend labels with 'line breaks'." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2024-03-26T14:31:36.068374Z", "iopub.status.busy": "2024-03-26T14:31:36.068209Z", "iopub.status.idle": "2024-03-26T14:31:36.075998Z", "shell.execute_reply": "2024-03-26T14:31:36.075817Z" } }, "outputs": [ { "data": { "text/html": [ " \n", " " ], "text/plain": [ "