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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8

lets_plot-1.5.6-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.6-cp37-cp37m-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m

lets_plot-1.5.6-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.6-cp36-cp36m-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m

lets_plot-1.5.6-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.6-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: lets_plot-1.5.6-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.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 dddd96a67a5a19ee2ae64a9c3574403879a8396bd2f7efb9607818d5eec0b47f
MD5 f9b3e5ec952092394e42f74a3f7d7115
BLAKE2b-256 2a328ed869c42ac9ffb093b1ab5cd6c30218b8ebc5acfd91a0852b5990b3f575

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lets_plot-1.5.6-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.6-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dfde80965bb7649c09dd11331501b5dbefb025fa3dcee67e617e43af97c98dae
MD5 cb9af9a068f1687c30b374a2b4bb50a9
BLAKE2b-256 05df11049b095b8a8eb7aa81f9b0ae9137852c516550db5e71efc14d46870c70

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lets_plot-1.5.6-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.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 84e6427e67128d32ba01ce5be89f1b1ed7a2be14e6bba30c21e342274f88816b
MD5 aedacef658f0a177de0a49ebcfb1ca81
BLAKE2b-256 6dfdb506a2f8dccff144806d7fb93f12621f46e94335e32151e6c703e38d3d0b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lets_plot-1.5.6-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.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 74892c87ec42c4ad00730c5ef7acdf03adb0b6ff15f70da383b84c481c188556
MD5 85336fb59ee3f82dd3b9d2b8726ed0ff
BLAKE2b-256 327f3abe36055beab13bd53cb7f0b68636bb55d1d5170b98c907ab378e7bf17a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lets_plot-1.5.6-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.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d424a2e663ebfd993924141e08278fe67949baaa574b31c5f7b36882b52dc033
MD5 315c47b632af1ba8c894c560b6a4b943
BLAKE2b-256 f85fd3018d3468defd68bde7b70e2e86665a5c9e875c522e2996868655ae6de2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lets_plot-1.5.6-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.6-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9c2fa85098a28cb1e7a4740d55ae58bf257ae007dae970853f81e321eeafb12e
MD5 34289331d7edb011e13921d320988c3c
BLAKE2b-256 c49f376e7711fdefe60aae66709de03538a0289878ac6c6ca81e982de0a7b228

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lets_plot-1.5.6-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.6-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 de9c47d29f1f7f32637812442c14a7f17e31ad754060f8984e90cf4ffb780a78
MD5 2a508caf815f9ef65c20975a54b75c4a
BLAKE2b-256 21d05b33b6ccf3b5a7fb83dac68e6475690be0c484b25248f5d62a20f6d05e9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lets_plot-1.5.6-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.6-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cf1d3de7678f1591fa0c311f4378df5427e8756eef397d0af0145aee522aac44
MD5 c825afb0319587f191039543c4d6e514
BLAKE2b-256 daf8213673624cd8dd3d8b442ad0267dea1b48dbecfcb22dfab8fc1accf7792d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lets_plot-1.5.6-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.6-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 f2c6e8cc8c840e925aae94599181239c93b3a85e978623365d14f4646ca99736
MD5 431e05b1effcd22a890d1569762f73a2
BLAKE2b-256 17f429d21c49c559c59330bbec82a80a2cf0fc6c59d958f5bd1e60f1de175768

See more details on using hashes here.

Supported by

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