{ "cells": [ { "cell_type": "markdown", "id": "558d28c0", "metadata": {}, "source": [ "# Handling an overplotting on a scatter plot: `geom_count()`/`stat_sum()`\n", "\n", "The `geom_count()` counts the number of observations at each location. \n", "\n", "Computed variables:\n", "\n", "- `..n..` - number of observations at location\n", "- `..prop..` - value in range 0..1 : share of observations at location\n", "- `..proppct..` - value in range 0..100 : % of observations at location" ] }, { "cell_type": "code", "execution_count": 1, "id": "da3d73f3", "metadata": { "execution": { "iopub.execute_input": "2025-11-05T13:44:48.043208Z", "iopub.status.busy": "2025-11-05T13:44:48.043100Z", "iopub.status.idle": "2025-11-05T13:44:48.046383Z", "shell.execute_reply": "2025-11-05T13:44:48.046129Z" } }, "outputs": [], "source": [ "import pandas as pd\n", "\n", "from lets_plot import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "08103843", "metadata": { "execution": { "iopub.execute_input": "2025-11-05T13:44:48.047365Z", "iopub.status.busy": "2025-11-05T13:44:48.047295Z", "iopub.status.idle": "2025-11-05T13:44:48.049220Z", "shell.execute_reply": "2025-11-05T13:44:48.048987Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "LetsPlot.setup_html() " ] }, { "cell_type": "code", "execution_count": 3, "id": "99409355", "metadata": { "execution": { "iopub.execute_input": "2025-11-05T13:44:48.050020Z", "iopub.status.busy": "2025-11-05T13:44:48.049948Z", "iopub.status.idle": "2025-11-05T13:44:48.131672Z", "shell.execute_reply": "2025-11-05T13:44:48.131302Z" } }, "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", "
| 3 | \n", "4 | \n", "audi | \n", "a4 | \n", "2.0 | \n", "2008 | \n", "4 | \n", "auto(av) | \n", "f | \n", "21 | \n", "30 | \n", "p | \n", "compact | \n", "
| 4 | \n", "5 | \n", "audi | \n", "a4 | \n", "2.8 | \n", "1999 | \n", "6 | \n", "auto(l5) | \n", "f | \n", "16 | \n", "26 | \n", "p | \n", "compact | \n", "