{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Creating multi-panel plots using `facets`.\n", "\n", "#### Problem\n", "\n", "You want to see more aspects of your data and it's not practical to use the regular `aesthetics` approach for that.\n", "\n", "#### Solution - `facets`\n", "\n", "You can add one or more new dimentions to your plot using `faceting`.\n", "\n", "This approach allows you to split up your data by one or more variables and plot the subsets of data together.\n", "\n", "\n", "In this demo we will explore how various faceting functions work, as well as the built-in `sorting` and `formatting` options." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:27:10.032779Z", "iopub.status.busy": "2024-04-17T07:27:10.032659Z", "iopub.status.idle": "2024-04-17T07:27:10.352739Z", "shell.execute_reply": "2024-04-17T07:27:10.352544Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import numpy as np\n", "import pandas as pd\n", "\n", "from lets_plot import *\n", "LetsPlot.setup_html()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2024-04-17T07:27:10.366147Z", "iopub.status.busy": "2024-04-17T07:27:10.366003Z", "iopub.status.idle": "2024-04-17T07:27:10.713504Z", "shell.execute_reply": "2024-04-17T07:27:10.713303Z" } }, "outputs": [ { "data": { "text/html": [ "\n", " | miles per gallon | \n", "number of cylinders | \n", "engine displacement (cu. inches) | \n", "engine horsepower | \n", "vehicle weight (lbs.) | \n", "time to accelerate (sec.) | \n", "model year | \n", "origin of car | \n", "vehicle name | \n", "
---|---|---|---|---|---|---|---|---|---|
0 | \n", "18.0 | \n", "8 | \n", "307.0 | \n", "130 | \n", "3504 | \n", "12.0 | \n", "70 | \n", "US | \n", "chevrolet chevelle malibu | \n", "
1 | \n", "15.0 | \n", "8 | \n", "350.0 | \n", "165 | \n", "3693 | \n", "11.5 | \n", "70 | \n", "US | \n", "buick skylark 320 | \n", "
2 | \n", "18.0 | \n", "8 | \n", "318.0 | \n", "150 | \n", "3436 | \n", "11.0 | \n", "70 | \n", "US | \n", "plymouth satellite | \n", "