Skip to main content

An open source library for statistical plotting

Project description

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.

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.5.5-cp38-cp38-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.8 Windows x86-64

lets_plot-1.5.5-cp38-cp38-manylinux1_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.8

lets_plot-1.5.5-cp38-cp38-macosx_10_9_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

lets_plot-1.5.5-cp37-cp37m-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

lets_plot-1.5.5-cp37-cp37m-manylinux1_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.7m

lets_plot-1.5.5-cp37-cp37m-macosx_10_9_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

lets_plot-1.5.5-cp36-cp36m-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.6m Windows x86-64

lets_plot-1.5.5-cp36-cp36m-manylinux1_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.6m

lets_plot-1.5.5-cp36-cp36m-macosx_10_7_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

Details for the file lets_plot-1.5.5-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: lets_plot-1.5.5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for lets_plot-1.5.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2a803afdf162b7149fc8ec358727ab0c57e3d08486f1ab7288c9e94b2458f62e
MD5 1c3117f6ad82d641c66015b5d643850e
BLAKE2b-256 c225cb962dc40bea37632be01ed1c3238e5dfaa18f40b159e4f4e561fc971d40

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for lets_plot-1.5.5-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1539a2e7e42c17116439c26581cb6695a98489ebd18b333910d4d6cd310966ca
MD5 9afe7fc622b06e07ec334016c3fb6b30
BLAKE2b-256 87b4ad653e62affc01b7bcc2b6ac2f041d533bceb0beee049b22ee14f8eaa1c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lets_plot-1.5.5-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using 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

File hashes

Hashes for lets_plot-1.5.5-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d88b15ddddfda7a4bfc561d2d3cb4fa9c39422590a625a1dd1fd9d10e66e4cb1
MD5 0afc7f15df4246de3eb68c106db315f9
BLAKE2b-256 532b7bfaa8adc91f6f2c32b61a4ae0174b73d31eeea3954f3369cb5b31d67295

See more details on using hashes here.

File details

Details for the file lets_plot-1.5.5-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: lets_plot-1.5.5-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for lets_plot-1.5.5-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 2947d7e686da97ce185e7248774cd7173a2527433a042f6aa973af5f41b23955
MD5 6277e08f020150d5198a400d3710e287
BLAKE2b-256 f93e4884494e5f4c47e40de961ddecf905219edf31f8df9fdf0e8107aaf09df5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for lets_plot-1.5.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 25569d8ac4d026293d2eacc0b503b764860ca4b884f4ae3bcab969302496ff34
MD5 20116ded16a4ba5e9f77a714f392fc22
BLAKE2b-256 c6b743f070edc56a06e438f2eaa8a9122884b670e72015ecd7dd7c522061d953

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lets_plot-1.5.5-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using 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

File hashes

Hashes for lets_plot-1.5.5-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a7aba9c33fcea338c726668fa1e7461a0e881dc655ddef5cabd0ddf0bc8a98a8
MD5 31953f04f0c92b8b81fe5ba01d532310
BLAKE2b-256 c39822517b6f6f5e2fd77d94504218490127ac54170411f42a61882b6d5f56e6

See more details on using hashes here.

File details

Details for the file lets_plot-1.5.5-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: lets_plot-1.5.5-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for lets_plot-1.5.5-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 b29cb0817ccf89cc75896a46fdcf8f070d8e146cc4cd3383e2d7e4fb5ef9c68e
MD5 0fdd61502efcc680f37ddcf8a8cb3f99
BLAKE2b-256 c125513c42f25cde9ceabab5e865cce4853562dc8e2329902de01c2f2f1274be

See more details on using hashes here.

File details

Details for the file lets_plot-1.5.5-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: lets_plot-1.5.5-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.6m
  • Uploaded using 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

File hashes

Hashes for lets_plot-1.5.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6e36c57618e2b61fd13e95283e3a772440b6ab41282fb3199871354b636bb235
MD5 a31576686590f53b0a22a0831b95772e
BLAKE2b-256 de75f630e54a9b49ea5e9a5691f7d2b9ad30d1621c409f039b5697ef22127936

See more details on using hashes here.

File details

Details for the file lets_plot-1.5.5-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: lets_plot-1.5.5-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.6m, macOS 10.7+ x86-64
  • Uploaded using 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

File hashes

Hashes for lets_plot-1.5.5-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 0f5d9cd152b49d401d46773512a0c4f49a141707fbcff82658b95774fcca0c12
MD5 045b56b7b34a9e9a15e676c8cddfc6b9
BLAKE2b-256 20cc7ba721627d10f81759a19724a9acdc4485a91f9b499d3432ea83b3cc8e03

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