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-plotVerified import paths — ran on the pinned version, not inferred.
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.
Refer to the updated Geocoding documentation for the new API structure and migrate your code accordingly.
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.
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.
Always include `from lets_plot import LetsPlot; LetsPlot.setup_html()` at the beginning of your notebook session.
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.
Add `from lets_plot import LetsPlot; LetsPlot.setup_html()` to the top of your notebook.
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)`.