Skip to main content

Lets-Plot for Python

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

Implementation Overview

The Lets-Plot python extension includes 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 and is almost identical to the one we ship as PyPI package. This is because Lets-Plot is an offshoot of the Datalore project from which it was extracted to a separate plotting library.

One important difference is that the python package in Datalore is named datalore.plot and the package you install from PyPI has name lets_plot.

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.

Installation

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

pip install lets-plot

Quickstart in Jupyter

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

import numpy as np
from lets_plot import *

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


What is new in v.1.2.0

  • Shapely and GeoPandas support.

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

    Examples:

Couldn't load kotlin_island.png

  • Plot cropping using xlim, ylim parameters of coordinate system.

    See GeoPandas demos above.

  • LOESS smoothing method in geom_smooth: geom_smooth.ipynb

  • New geometry layers.

    geom_crossbar, geom_linerange, geom_pointrange: error_bars.ipynb

    geom_bin2d: density_2d.ipynb

Example Notebooks

Try the following examples to study more features of the Lets-Plot library.

The following features of Lets-Plot are not present or have different implementation in other Grammar of Graphics libraries.

Plotting functions
  • ggsize() - sets the size of the plot. Used in many examples starting from quickstart.

  • geom_density2df() - fills space between equal density lines on a 2D density plot. Similar to geom_density2d but supports the fill aesthetic.

    Example: density_2d.ipynb

  • geom_contourf() - fills space between the lines of equal level of the bivariate function. Similar to geom_contour but supports the fill aesthetic.

    Example: contours.ipynb

  • geom_image() - displays an image specified by a ndarray with shape (n,m) or (n,m,3) or (n,m,4).

    Example: image_101.ipynb

    Example: image_fisher_boat.ipynb

  • gg_image_matrix() - a utility helping to combine several images into one graphical object.

    Example: image_matrix.ipynb

GGBanch

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.

Examples:

Data sampling

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

Learn more about sampling in Lets-Plot.

Artistic demos

A set of interesting notebooks with Lets-Plot for visualization.

Change Log

See Lets-Plot at Github.

License

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

Metadata

Release files for lets-plot 1.2.0

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.2.0
File Actions
lets_plot-1.2.0-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details for lets_plot-1.2.0-cp38-cp38-manylinux1_x86_64.whl
lets_plot-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details for lets_plot-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl
lets_plot-1.2.0-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details for lets_plot-1.2.0-cp37-cp37m-manylinux1_x86_64.whl
lets_plot-1.2.0-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details for lets_plot-1.2.0-cp37-cp37m-macosx_10_9_x86_64.whl

Total release size: 12.1 MB

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

Download URL lets_plot-1.2.0-cp38-cp38-manylinux1_x86_64.whl
Size 3.3 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
2c35338f468630dd06b85fb93d1ad301373c6adfe608e3e16827238269b67c7d
BLAKE2b-256 checksum
How to use checksums
73fa8ce0469f33c681437a6492cbeb0816d3e15b2bb317b53305e4715351f08d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.8.0

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

Download URL lets_plot-1.2.0-cp38-cp38-macosx_10_9_x86_64.whl
Size 2.8 MB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
9458372203f6bee95dba6c60c3cf64827c3098e62501b7d99fa95131285d0a64
BLAKE2b-256 checksum
How to use checksums
7ddedd5b59d98be2131e4b39c0fb22f89823a452c9a2437a838605003f4ae673
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191201 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.0

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

Download URL lets_plot-1.2.0-cp37-cp37m-manylinux1_x86_64.whl
Size 3.3 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
6cef1b50b9f8e018baf110775673e070ffe8b4f12e99555685a20dfccdee43a4
BLAKE2b-256 checksum
How to use checksums
9683af18907f0da74198c458119a3b920cb510acf36cedbf1151fbd88f21437b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191030 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.8.0

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

Download URL lets_plot-1.2.0-cp37-cp37m-macosx_10_9_x86_64.whl
Size 2.8 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
4f337c2aa5606070683f4bed0b8f575ae5c8e863f2f1752adf3dce3caeb5e129
BLAKE2b-256 checksum
How to use checksums
f70733fb2db36307a2020bebe7ec6d6836d91a0edda7fe9c44335918c67d5e44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191201 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.8.0

Security for lets-plot 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.0 This release

4 release files No provenance

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