Skip to main content

An open source library for statistical plotting

Project description

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 functions and built-in sampling 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

Examples

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

Quickstart in Jupyter: quickstart.ipynb

Histogram, density plot, box plot and facets: distributions.ipynb

Error-bars, points, lines, bars, dodge position: error_bars.ipynb

Points, point shapes, linear regression, jitter position: scatter_plot.ipynb

Points, density2d, polygons, density2df: density_2d.ipynb

Tiles, contours, polygons, contourf: contours.ipynb

Various presentation options: legend_and_axis.ipynb

Unfamiliar functions used in the examples

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

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

    Example: density_2d.ipynb

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

    Example: contours.ipynb

Sampling

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

Learn more about sampling in Lets-Plot.

License

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

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

lets_plot-1.0.0-cp38-cp38-manylinux1_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.8

lets_plot-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

lets_plot-1.0.0-cp37-cp37m-manylinux1_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.7m

lets_plot-1.0.0-cp37-cp37m-macosx_10_9_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

File details

Details for the file lets_plot-1.0.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: lets_plot-1.0.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.8
  • Uploaded using 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

File hashes

Hashes for lets_plot-1.0.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9a60b614d6670207429c3dce54a5c247774f8b506e1062d898bb5a860d2e8614
MD5 567461d2d350dd28378a562540822de3
BLAKE2b-256 610a45aeb5359c4987b8bd741f7004b8a61fb6452e5d4c6b7bfd398f059e903c

See more details on using hashes here.

File details

Details for the file lets_plot-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: lets_plot-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191101 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for lets_plot-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 143b2910b4c9327c6586de3c8994f33c5d126554cdd13a1396d3ea2609c73eb3
MD5 d2b452b20391f1861209962a2d6b8809
BLAKE2b-256 4e179e2ab0cf4c02ab96d80b2c49b1e64f588dc2b949bab217d255d5daf53325

See more details on using hashes here.

File details

Details for the file lets_plot-1.0.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: lets_plot-1.0.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.7m
  • Uploaded using 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

File hashes

Hashes for lets_plot-1.0.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 676df4a96b299b4fb3ba9eba0aad7c4c0d4f16fc30297f3139e7097774758788
MD5 3e914ea6aeeb78f8f064ba36073f2a6d
BLAKE2b-256 a176ee2d9075641257e8492bf6c13329c06f6b325126007a6edea8988bcc7d2f

See more details on using hashes here.

File details

Details for the file lets_plot-1.0.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: lets_plot-1.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0.post20191101 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0

File hashes

Hashes for lets_plot-1.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ae27915292876957c4b6f9a42b4e1c602b1818912e737382d5ab34a7d8711036
MD5 8df4147d4818962d1618ef88aba7a14e
BLAKE2b-256 556c47ed9ca27a4433c3e0403924c94c70e51fa7b2ab209e4357c49204c3ef9e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page