An Open-source Plotting Library for Statistical Data

JB Official Latest release MIT License

Python versions: 3.6-3.9

OS: Linux, macOS, Windows

Installation

pip install lets-plot

Prerequisites

Datalore

You can try Lets-Plot in Datalore where it is available out-of-the-box.

Quickstart

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4
 5np.random.seed(12)
 6data = dict(
 7    cond=np.repeat(['A', 'B'], 200),
 8    rating=np.concatenate((np.random.normal(0, 1, 200), np.random.normal(1, 1.5, 200)))
 9)
10
11ggplot(data, aes(x='rating', fill='cond')) + ggsize(700, 300) + \
12    geom_density(color='dark_green', alpha=.7) + scale_fill_brewer(type='seq') + \
13    theme(panel_grid_major_x='blank')
https://nbviewer.jupyter.org/github/JetBrains/lets-plot-docs/blob/master/source/examples/cookbook/quickstart.ipynbhttps://datalore.jetbrains.com/view/notebook/Vl3fAET56UBray6rPufmDAhttps://www.kaggle.com/alshan/lets-plot-quickstarthttps://colab.research.google.com/drive/1uYYZcG0g0kP4lJdPkpWB8aBS96ioDii2?usp=sharinghttps://deepnote.com/project/673ea421-638e-469d-8d04-5cc4c6e0258f#%2Fnotebook.ipynbhttps://nextjournal.com/alshan/lets-plot-quickstart?token=H8DPBC6A3kZqWmusxWzZ9chttps://plugins.jetbrains.com/plugin/14379-lets-plot-in-sciviewhttps://www.jetbrains.com/dataspell

Meet the Grammar of Graphics

_images/ggplot2-elegant-graphics-for-data-analysis.jpg

Lets-Plot API is largely based on the API provided by ggplot2 package well-known to data scientists who use R.

To learn more about the grammar of graphics, we recommend an excellent book called “ggplot2: Elegant Graphics for Data Analysis”. This will be a good prerequisite for further exploration of the Lets-Plot library.

Explore Your Data with Lets-Plot

Key Features

_images/ggplot2-like-api.svg

ggplot2-like API

A bridge between R (ggplot2) and Python Data visualization.

_images/graphics-grid.svg

Grouping Plots

GGBunch shows a collection of plots on one figure. Each plot in the collection can have an arbitrary location and size.

_images/platforms.svg

Suitable for Scientist and Developer

Works in computational notebooks (Jupyter, Datalore, Kaggle, Colab, Deepnote) and in JetBrains professional IDEs: PyCharm and DataSpell.

_images/tooltips.svg

Customizable Tooltips

You can customize the content, values formatting and appearance of tooltip for any geometry layer in your plot. Learn more.

_images/kotlin.svg

Kotlin API

R, Python, what’s next? Right. Lets-Plot Kotlin API enables data visualization in JVM and Kotlin/JS applications as well as in scientific notebooks like Jupyter and Datalore.

_images/formatting.svg

Formatting

Lets-Plot supports formatting of numeric and date-time values in tooltips, legends, on the axes and text geometry layer. Learn more.

_images/geospatial-visualization.svg

Geospatial Visualization

Find spatial objects with the help of our powerful and easy to use Geocoding module. In case you already have GeoDataFrame on hand - plot it straight away.

_images/sampling.svg

Sampling

Sampling is a special technique of data transformation, which helps to deal with large datasets and overplotting. Learn more.

_images/interactive-maps.svg

Interactive Maps

Interactive maps allow zooming and panning around your geospatial data with customizable vector or raster basemaps as a backdrop. Learn more.

_images/export.svg

Export to SVG and HTML

The ggsave() function is an easy way to export plot to a file in SVG or HTML formats.

_images/offline-mode.svg

‘No Javascript’ and Offline Mode

In the ‘no javascript’ mode Lets-Plot generates plots as bare-bones SVG images. Plots in the notebook with option offline=True will be working without an Internet connection. Learn more.