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, 3.9

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-2.0.0rc2-cp39-cp39-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.9 Windows x86-64

lets_plot-2.0.0rc2-cp39-cp39-manylinux1_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.9

lets_plot-2.0.0rc2-cp39-cp39-macosx_10_9_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

lets_plot-2.0.0rc2-cp38-cp38-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

lets_plot-2.0.0rc2-cp38-cp38-macosx_10_9_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

lets_plot-2.0.0rc2-cp37-cp37m-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

lets_plot-2.0.0rc2-cp37-cp37m-macosx_10_9_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

lets_plot-2.0.0rc2-cp36-cp36m-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

lets_plot-2.0.0rc2-cp36-cp36m-macosx_10_7_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

File details

Details for the file lets_plot-2.0.0rc2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: CPython 3.9, 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-2.0.0rc2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6109961afe9ea05a1ad4f41254639df71a0c9d8d01783f6392112d3de4215f8f
MD5 99365d6447cde48dbb323b906908cdb1
BLAKE2b-256 63163700ed207b33c3d6c97a0f26bd5ff2efebe9e5f5e36f1c6c32e53c3a9bd7

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.9
  • 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-2.0.0rc2-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0dfaca01136a6f86c7ef120372f820bcd52e41b47e145e715a8f0436467cdec3
MD5 42cd4e356dca017a3e396512b0e367f9
BLAKE2b-256 a58b456bcc2c4366a2628c85a4bc96c0d7cdd36bdad7c013b4638ee7fb62dd86

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.9, 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-2.0.0rc2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5974525410578aa2177eb38dda8475f6347df33e79fcbfce7e50dae5420af260
MD5 d6b58142fc4500f3fe6e17c5bf4d48fa
BLAKE2b-256 8e361666000a83bc252ab251c16409939b66a26d0984c505d6f6ba0d6f011d18

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 2.5 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-2.0.0rc2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 a475e59ddbc7d87e78a40faa0cfb6f80fa5de755edccb65aa83c1436f61b0435
MD5 77ea63eee9585a9de12cbb41fa62079f
BLAKE2b-256 1854a359475155f146456b193af777cbb823e499e7cc650e06ec8eb7990a7c3b

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-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-2.0.0rc2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6b5bdaaff446dc37f1321b53ceb11f0e2c809a6dea9584294c16f30fb984886b
MD5 07a7e7429f290c4e6fcde661b8a93c09
BLAKE2b-256 fffb7dce2b0b93b0103c69a6c89dab6b4e90ad4888b9036383b78c2c67666582

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.0 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-2.0.0rc2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b143df1af2004bebb1efc65efa25057d71f67f168c54c325c36b096733bd0b65
MD5 c1f6efaa47260fd519dda7a8ad9865b1
BLAKE2b-256 4fde7c4ca0948f96bdbc8e114dac88c1d82a87083d9608d59786ecc23e893fd1

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 2.5 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-2.0.0rc2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f248a9ce7c427f2969ea6c88ebc9f325c4d08767989f13523245199a92070835
MD5 2faa72de4935f0b0ec984e3427e20f72
BLAKE2b-256 68c76111181e5812821167a6cb1bdedcdf6f681e45cbe44a6dd24b10f49bd2b7

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-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-2.0.0rc2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 77024b896e35c402f128723913feeea09839c2e462760deb7c795d6c52bab557
MD5 055aeae758f893bb958119bc21b38cf4
BLAKE2b-256 dea6eab7ac87a639a6123bad05212c349708cd5820646ba52d84ffdbefd749c8

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 3.0 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-2.0.0rc2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 502c107decf43894e33a765b9a9687dc6c2176ea24f467b1a7da285b7460d706
MD5 5ae7e848af2b87ada718ccdb73e7b2d7
BLAKE2b-256 9720a581b4b24a0fdbebfc14724cee8fbaa910fc415586b711e832c978d7cbf3

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 2.5 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-2.0.0rc2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 e63b45a8e408512a55bf95b1566a15cb21de63537c8edee8f0ca84049ec74b52
MD5 6570f844f0c51fb56f7e0ffcdb62671f
BLAKE2b-256 8b0e59ed05a215fd0865133f3fd609532a6e7bb8c6123731a67afed937aa4f65

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-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-2.0.0rc2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d30f80391f98b87eb8a092faf48579da823a856bacaf57523f603fc229fbf709
MD5 59c7e93af9647e53f46df5624b16ca36
BLAKE2b-256 66cb330655070a6b79c23e0ae0593696dca01f6f99d8213590557c5b9baf0202

See more details on using hashes here.

File details

Details for the file lets_plot-2.0.0rc2-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: lets_plot-2.0.0rc2-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 3.0 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-2.0.0rc2-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 dfb1de13f831593d0340703f2448bfb41e3b913c4efa09cc22823e1a37c0a848
MD5 cc4cfb9fc1f68df3d1c92705243d2aa9
BLAKE2b-256 224b50a0a599ffb8f0b0528d143a0cabc57fe7297ac74fd096bcfc6fae5627b4

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