{ "cells": [ { "cell_type": "markdown", "id": "answering-manner", "metadata": {}, "source": [ "# Using Dictionaries for Customizing Scale' Breaks, Labels and Values\n", "\n", "`breaks` and `lables` arguments in `scale_xxx()` function family each accepts list of values for customizing the scale breaks or labels.\n", "\n", "However, it is often more convenient to use a dictionary of breaks (in the `labels` parameter) or a dictionary of labels (in the `breaks` parameter) for the breaks/labels customization.\n", "\n", "Similar situation is with parameters `breaks` and `values` in the `scale_xxx_manual()` function family.\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "pressed-angola", "metadata": { "execution": { "iopub.execute_input": "2024-11-01T20:16:54.601532Z", "iopub.status.busy": "2024-11-01T20:16:54.601453Z", "iopub.status.idle": "2024-11-01T20:16:54.927606Z", "shell.execute_reply": "2024-11-01T20:16:54.927192Z" } }, "outputs": [], "source": [ "import pandas as pd\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "recorded-horizon", "metadata": { "execution": { "iopub.execute_input": "2024-11-01T20:16:54.929057Z", "iopub.status.busy": "2024-11-01T20:16:54.928909Z", "iopub.status.idle": "2024-11-01T20:16:54.931354Z", "shell.execute_reply": "2024-11-01T20:16:54.931120Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 3, "id": "honest-stewart", "metadata": { "execution": { "iopub.execute_input": "2024-11-01T20:16:54.932384Z", "iopub.status.busy": "2024-11-01T20:16:54.932314Z", "iopub.status.idle": "2024-11-01T20:16:55.272980Z", "shell.execute_reply": "2024-11-01T20:16:55.272473Z" } }, "outputs": [ { "data": { "text/html": [ "\n", " | Unnamed: 0 | \n", "manufacturer | \n", "model | \n", "displ | \n", "year | \n", "cyl | \n", "trans | \n", "drv | \n", "cty | \n", "hwy | \n", "fl | \n", "class | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "1 | \n", "audi | \n", "a4 | \n", "1.8 | \n", "1999 | \n", "4 | \n", "auto(l5) | \n", "f | \n", "18 | \n", "29 | \n", "p | \n", "compact | \n", "
1 | \n", "2 | \n", "audi | \n", "a4 | \n", "1.8 | \n", "1999 | \n", "4 | \n", "manual(m5) | \n", "f | \n", "21 | \n", "29 | \n", "p | \n", "compact | \n", "
2 | \n", "3 | \n", "audi | \n", "a4 | \n", "2.0 | \n", "2008 | \n", "4 | \n", "manual(m6) | \n", "f | \n", "20 | \n", "31 | \n", "p | \n", "compact | \n", "