Skip to main content

Lets-Plot for Python official JetBrains project

Latest Release
License
OS Linux, MacOS, Windows
Python versions 3.6, 3.7, 3.8

Overview

The Lets-Plot for Python library includes a native backend and a Python API, which was mostly based on the ggplot2 package well-known to data scientists who use R.

R ggplot2 has extensive documentation and a multitude of examples and therefore is an excellent resource for those who want to learn the grammar of graphics.

Note that the Python API being very similar yet is different in detail from R. Although we have not implemented the entire ggplot2 API in our Python package, we have added a few new features to our Python API.

You can try the Lets-Plot library in Datalore. Lets-Plot is available in Datalore out-of-the-box (i.e. you can ignore the Installation chapter below).

The advantage of Datalore as a learning tool in comparison to Jupyter is that it is equipped with very friendly Python editor which comes with auto-completion, intentions, and other useful coding assistance features.

Begin with the quickstart in Datalore notebook to learn more about Datalore notebooks.

Watch the Datalore Getting Started Tutorial video for a quick introduction to Datalore.

Installation

1. For Linux and Mac users:

To install the Lets-Plot library, run the following command:

pip install lets-plot

2. For Windows users:

Install Anaconda3 (or Miniconda3), then install MinGW toolchain to Conda:

conda install m2w64-toolchain

Install the Lets-Plot library:

pip install lets-plot

Quick start with Jupyter

You can use Lets-Plot in Jupyter notebook or other notebook of your choice, like Datalore, Kaggle or Colab.

To evaluate the plotting capabilities of Lets-Plot, add the following code to a Jupyter notebook:

import numpy as np
from lets_plot import *
LetsPlot.setup_html()        

np.random.seed(12)
data = dict(
    cond=np.repeat(['A','B'], 200),
    rating=np.concatenate((np.random.normal(0, 1, 200), np.random.normal(1, 1.5, 200)))
)

ggplot(data, aes(x='rating', fill='cond')) + ggsize(500, 250) \
+ geom_density(color='dark_green', alpha=.7) + scale_fill_brewer(type='seq') \
+ theme(axis_line_y='blank')
Couldn't load quickstart.png
        

Example Notebooks

See Example Notebooks.

GGBunch

GGBunch allows to show a collection of plots on one figure. Each plot in the collection can have arbitrary location and size. There is no automatic layout inside the bunch.

Data Sampling

Sampling is a special technique of data transformation, which helps dealing with large datasets and overplotting.

Learn more: Data Sampling.

Export to File

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

Note: The ggsave() function currently do not save images of interactive maps to SVG.

Example notebook: export_SVG_HTML

The 'bistro' Package

The 'bistro' package is a collection of higher level API functions, each allows to create a certain kind of plot with a single function call instead of combining a plethora of plot features manually.

Correlation Plot

from lets_plot.bistro.corr

The corr_plot() function creates a fluent builder object offering a set of methods for configuring of beautiful correlation plots. A call to the terminal build() method in the end will create a resulting plot object.

Example: correlation_plot.ipynb

Image Matrix

from lets_plot.bistro.im

The image_matrix() function arranges a set of images in a grid.

Example: image_matrix.ipynb

The image_matrix() function uses geom_image under the hood, so you might want to check out these demos as well:

Geospatial

GeoPandas Support

GeoPandas GeoDataFrame is supported by the following geometry layers: geom_polygon, geom_map, geom_point, geom_text, geom_rect.

Learn more: GeoPandas Support.

Couldn't load kotlin_island.png

Interactive Maps

Interactive maps allow zooming and panning around geospatial data that can be added to the base-map layer using regular ggplot geoms.

Learn more: Interactive Maps.

Geocoding API

Geocoding is the process of converting names of places into geographic coordinates.

Learn more: Geocoding API.

'No Javascript' Mode

In the 'no javascript' mode Lets-Plot genetares plots as bare-bones SVG images.

This mode is halpfull when there is a requirement to render notebooks in an 'ipnb' renderer which does not suppopt javascript (like GitHub's built-in renderer).

Activate 'no javascript' mode using the LetsPlot.setup_html() method call:

from lets_plot import *

LetsPlot.setup_html(no_js=True)

Alternativaly, you can set up the environment variable:

LETS_PLOT_NO_JS = true   (other accepted values are: 1, t, y, yes)

Note: interactive maps do not support the 'no javascript' mode.

Offline Mode

In classic Jupyter notebook the LetsPlot.setup_html() statement by default pre-loads Lets-Plot JS library from CDN. Alternatively, option offline=True will force Lets-Plot adding the full Lets-Plot JS bundle to the notebook. In this case, plots in the notebook will be working without an Internet connection.

from lets_plot import *

LetsPlot.setup_html(offline=True)

Note: internet connection is still required for interactive maps and geocoding API.

Interesting Demos

A set of interesting notebooks using Lets-Plot library for visualization.
Couldn't load klein_bottle.png

Scientific mode in IntelliJ IDEA / PyCharm

JetBrains Plugins JetBrains plugins

Plugin "Lets-Plot in SciView" is available at the JetBrains Plugin Repository.

The plugin adds support for interactive plots in IntelliJ-based IDEs with the enabled Scientific mode.

To learn more about the plugin check: Lets-Plot in SciView plugin homepage.

Couldn't load pycharm_quickstart.png Couldn't load pycharm_logo.png

What is new in 1.5.5

  • Correlation plot

    New higher level API in the 'bistro' package allowing with little efforts building of beautiful correlation plots.

  • 'no javascript' mode

    Enables plots that can be rendered in notebook renderers which do not support javascript. See 'No Javascript' Mode for more details.

  • New tooltip anchor options: 'center' and 'middle'

    See: Tooltip Customization) for more details.

See CHANGELOG.md for more details.

Change Log

See CHANGELOG.md.

License

Code and documentation released under the MIT license. Copyright © 2019-2020, JetBrains s.r.o.

Metadata

Release files for lets-plot 1.5.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for lets-plot 1.5.6
File
lets_plot-1.5.6-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
lets_plot-1.5.6-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details
lets_plot-1.5.6-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details
lets_plot-1.5.6-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
lets_plot-1.5.6-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
lets_plot-1.5.6-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details
lets_plot-1.5.6-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
lets_plot-1.5.6-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
lets_plot-1.5.6-cp36-cp36m-macosx_10_7_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64 Details

Total release size: 24.2 MB

Release files / lets_plot-1.5.6-cp38-cp38-win_amd64.whl

Download URL lets_plot-1.5.6-cp38-cp38-win_amd64.whl
Size 2.4 MB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
dddd96a67a5a19ee2ae64a9c3574403879a8396bd2f7efb9607818d5eec0b47f
BLAKE2b-256 checksum
How to use checksums
2a328ed869c42ac9ffb093b1ab5cd6c30218b8ebc5acfd91a0852b5990b3f575
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

Release files / lets_plot-1.5.6-cp38-cp38-manylinux1_x86_64.whl

Download URL lets_plot-1.5.6-cp38-cp38-manylinux1_x86_64.whl
Size 2.8 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
dfde80965bb7649c09dd11331501b5dbefb025fa3dcee67e617e43af97c98dae
BLAKE2b-256 checksum
How to use checksums
05df11049b095b8a8eb7aa81f9b0ae9137852c516550db5e71efc14d46870c70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / lets_plot-1.5.6-cp38-cp38-macosx_10_9_x86_64.whl

Download URL lets_plot-1.5.6-cp38-cp38-macosx_10_9_x86_64.whl
Size 2.9 MB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
84e6427e67128d32ba01ce5be89f1b1ed7a2be14e6bba30c21e342274f88816b
BLAKE2b-256 checksum
How to use checksums
6dfdb506a2f8dccff144806d7fb93f12621f46e94335e32151e6c703e38d3d0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / lets_plot-1.5.6-cp37-cp37m-win_amd64.whl

Download URL lets_plot-1.5.6-cp37-cp37m-win_amd64.whl
Size 2.4 MB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
74892c87ec42c4ad00730c5ef7acdf03adb0b6ff15f70da383b84c481c188556
BLAKE2b-256 checksum
How to use checksums
327f3abe36055beab13bd53cb7f0b68636bb55d1d5170b98c907ab378e7bf17a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

Release files / lets_plot-1.5.6-cp37-cp37m-manylinux1_x86_64.whl

Download URL lets_plot-1.5.6-cp37-cp37m-manylinux1_x86_64.whl
Size 2.8 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
d424a2e663ebfd993924141e08278fe67949baaa574b31c5f7b36882b52dc033
BLAKE2b-256 checksum
How to use checksums
f85fd3018d3468defd68bde7b70e2e86665a5c9e875c522e2996868655ae6de2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / lets_plot-1.5.6-cp37-cp37m-macosx_10_9_x86_64.whl

Download URL lets_plot-1.5.6-cp37-cp37m-macosx_10_9_x86_64.whl
Size 2.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
9c2fa85098a28cb1e7a4740d55ae58bf257ae007dae970853f81e321eeafb12e
BLAKE2b-256 checksum
How to use checksums
c49f376e7711fdefe60aae66709de03538a0289878ac6c6ca81e982de0a7b228
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / lets_plot-1.5.6-cp36-cp36m-win_amd64.whl

Download URL lets_plot-1.5.6-cp36-cp36m-win_amd64.whl
Size 2.4 MB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
de9c47d29f1f7f32637812442c14a7f17e31ad754060f8984e90cf4ffb780a78
BLAKE2b-256 checksum
How to use checksums
21d05b33b6ccf3b5a7fb83dac68e6475690be0c484b25248f5d62a20f6d05e9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

Release files / lets_plot-1.5.6-cp36-cp36m-manylinux1_x86_64.whl

Download URL lets_plot-1.5.6-cp36-cp36m-manylinux1_x86_64.whl
Size 2.8 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
cf1d3de7678f1591fa0c311f4378df5427e8756eef397d0af0145aee522aac44
BLAKE2b-256 checksum
How to use checksums
daf8213673624cd8dd3d8b442ad0267dea1b48dbecfcb22dfab8fc1accf7792d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / lets_plot-1.5.6-cp36-cp36m-macosx_10_7_x86_64.whl

Download URL lets_plot-1.5.6-cp36-cp36m-macosx_10_7_x86_64.whl
Size 2.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
f2c6e8cc8c840e925aae94599181239c93b3a85e978623365d14f4646ca99736
BLAKE2b-256 checksum
How to use checksums
17f429d21c49c559c59330bbec82a80a2cf0fc6c59d958f5bd1e60f1de175768
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release history Release notifications | RSS feed

4.9.0

35 release files

4.8.2

30 release files

4.7.3

25 release files

4.7.1

25 release files

4.7.0

25 release files

4.6.2

30 release files

4.5.2

30 release files

4.5.1

30 release files

4.5.0

30 release files

4.4.1

25 release files

4.3.3

25 release files

4.3.2

29 release files

4.3.1

29 release files

4.2.0

29 release files

4.0.1

24 release files

4.0.0

24 release files

3.0.0

24 release files

2.5.0

23 release files

2.4.0

17 release files

2.3.0

12 release files

2.2.1

12 release files

2.2.0

12 release files

2.1.0

12 release files

2.0.2

12 release files

2.0.1

12 release files

This release

1.5.6 This release

9 release files

1.5.5

9 release files

1.5.4

9 release files

1.5.3

9 release files

1.5.2

9 release files

1.5.1

9 release files

1.5.0

9 release files

1.4.2

9 release files

1.4.1

9 release files

1.4.0

9 release files

1.3.0

9 release files

1.2.1

4 release files

1.2.0

4 release files

1.1.0

4 release files

1.0.0

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page