Registry / data / lets-plot

lets-plot

JSON →
library4.10.1pypypi✓ verified 85d ago

Lets-Plot is an open-source, multiplatform plotting library for statistical data based on the Grammar of Graphics, heavily influenced by R's ggplot2. It provides a Python API for creating both static and interactive charts in notebooks and IDEs, supporting various data formats like Pandas DataFrames and NumPy. The current version is 4.9.0, with a regular release cadence often tied to its Kotlin counterpart.

pip install lets-plot
INSTALL
IMPORT
SIG · LETS-PLOT
L
lets-plot
datapythonv4.10.1
Install
3.7s avg
Import
92ms
Disk
68MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.10.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
build_error
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.7s · import 0.092s · 70MB
68MB installed
● package 68MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

All functions
from lets_plot import *
The library encourages importing all functions directly for ease of use due to its extensive API.
LetsPlot.setup_html()
from lets_plot import LetsPlot LetsPlot.setup_html()
from lets_plot import * # without calling setup_html()
Crucial for displaying plots in Jupyter notebooks and other HTML environments. Must be called once per session.

This quickstart demonstrates a basic scatter plot with a smoothed regression line, colored by category, using Pandas DataFrame as input. It includes the essential `LetsPlot.setup_html()` call for notebook environments.

import numpy as np import pandas as pd from lets_plot import * LetsPlot.setup_html() data = pd.DataFrame({ 'x': np.random.normal(0, 1, 100), 'y': np.random.normal(1, 1.5, 100), 'category': np.random.choice(['A', 'B'], 100) }) plot = (ggplot(data, aes(x='x', y='y', color='category')) + geom_point(size=5, alpha=0.6) + geom_smooth(method='lm', color='black', linetype='dashed') + ggtitle('Scatter Plot with Regression Line') ) plot
Debug
Known issues
breakingThe Geocoding API underwent a complete overhaul in Lets-Plot v2.0.0, rendering previous API implementations incompatible.
fix
Refer to the updated Geocoding documentation for the new API structure and migrate your code accordingly.
affects: >=2.0.0
breakingVersion 4.0.0 introduced significant internal package refactoring. While the Python API was largely unaffected, default qualitative color palettes (now 'Set1' from 'Set2') and default sizes for points and lines changed. It also caused partial incompatibility with older Kotlin API versions.
fix
Review plots for visual consistency and adjust color scales (`scale_color_manual`) or geom sizes as needed. For multiplatform projects, ensure Kotlin API versions are updated to maintain compatibility.
affects: >=4.0.0
breakingIn version 4.9.0 (primarily affecting Kotlin/JVM), JavaFX artifacts were removed, and the `lets-plot-image-export` module was deprecated. The `DefaultPlotPanelBatik` was replaced by `SwingPlotPanel` for JVM Swing applications.
fix
For JVM Swing applications, replace `DefaultPlotPanelBatik` with `SwingPlotPanel` from `org.jetbrains.letsPlot.awt.plot.swing`. For image export, use `PlotImageExport` from the `platf-awt` module.
affects: >=4.9.0
gotchaForgetting to call `LetsPlot.setup_html()` in Jupyter, JupyterLab, Google Colab, or other notebook environments will result in plots not being rendered or displayed.
fix
Always include `from lets_plot import LetsPlot; LetsPlot.setup_html()` at the beginning of your notebook session.
affects: All versions
Errors
Common errors & fixes
ImportError: DLL load failed while importing lets_plot_kotlin_bridge: The specified module could not be found.
This error typically occurs on Windows systems, especially when using Anaconda or Miniconda, and indicates missing native backend components required by Lets-Plot's Kotlin bridge.
fix
Install the `m2w64-toolchain` using `conda install m2w64-toolchain` before installing `lets-plot` with pip, or ensure your environment has the necessary C++ build tools.
Plots are not displayed in my Jupyter Notebook cell output.
The HTML rendering functionality for notebooks needs to be explicitly initialized once per session.
fix
Add `from lets_plot import LetsPlot; LetsPlot.setup_html()` to the top of your notebook.
Error: geom_contour : error if data is not sorted properly
The `geom_contour` geometry expects input data to be sorted correctly for proper contour calculation.
fix
Ensure your DataFrame is sorted by the x- and y-variables used in `geom_contour` before plotting. For example, `df.sort_values(by=['x_var', 'y_var'], inplace=True)`.
Upgrade
Version history
4.10.1latest on PyPI · released May 20, 2026
Audit
Dependencies
m2w64-toolchainoptionalRequired for native backend functionality on Windows when using Anaconda/Miniconda, prevents DLL load errors.
Agent activity
2 hits · last 30 days
node
2
Resources