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 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
Quick start with 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')
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:
-
Map building basics with Lets-Plot and GeoPandas: geopandas_naturalearth.ipynb
-
An inset map of Kotlin island: geopandas_kotlin_isl.ipynb
-
-
Plot cropping using the
xlim, ylim
coordinate system parameters.See geopandas_naturalearth.ipynb and geopandas_kotlin_isl.ipynb.
-
LOESS smoothing method in geom_smooth: geom_smooth.ipynb
-
New geometry layers.
geom_crossbar, geom_linerange, geom_pointrange
: error_bars.ipynbgeom_bin2d
: density_2d.ipynb
Example Notebooks
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
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 fromquickstart
. -
geom_density2df()
- fills space between equal density lines on a 2D density plot. Similar togeom_density2d
but supports thefill
aesthetic.Example: density_2d.ipynb
-
geom_contourf()
- fills space between the lines of equal level of the bivariate function. Similar togeom_contour
but supports thefill
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.
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
Built Distributions
File details
Details for the file lets_plot-1.3.0rc1-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: lets_plot-1.3.0rc1-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 192f904d6bf9084499732063cc80003acee1a507db5121444837288bf115193c |
|
MD5 | bbb16cd883da3a1c1f441dd1b3761c11 |
|
BLAKE2b-256 | d413f541732209985585cb10a25ffae854a6752f7b574dfbd5d2b4db7af64970 |
File details
Details for the file lets_plot-1.3.0rc1-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.3.0rc1-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 4.9 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/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68b9140c9bffcdf0ab70feaaf6896b0b4a3548269ff82939ae584dadb01bdf3f |
|
MD5 | 0aadd6862289848665e9d41ec4327037 |
|
BLAKE2b-256 | 16429e4d4506681eabcdca77e77c62262929c0a1fc3762e87e0025ba3f8fa6ce |
File details
Details for the file lets_plot-1.3.0rc1-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.3.0rc1-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.8, macOS 10.9+ x86-64
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2e768f0ae5c7b285c908c99749e1fcefbe3b2465f09f604f3f5b68b20ce5ca9 |
|
MD5 | 3c7e3787633ae94590f44294a82a6dbf |
|
BLAKE2b-256 | b19c830fad863dcfbd6b5aa1a9141cd1fc15736b176be6f96fe601ba0f2c4f3b |
File details
Details for the file lets_plot-1.3.0rc1-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: lets_plot-1.3.0rc1-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 264b7936181a28017120754bc2ed97e825201af29fa9eb4cb74fbd8a7d255314 |
|
MD5 | 3685cf3fb5400b51200bf0447949e32b |
|
BLAKE2b-256 | f1c84c4ec914df14738f2a771a4aaa15cd65ea47c4688fdda0f08ed67b8565d2 |
File details
Details for the file lets_plot-1.3.0rc1-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.3.0rc1-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 4.9 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/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2525dd162398cb654c87c3420c8197e58d42c9125206a7cd8a9687e197c58ef |
|
MD5 | 26b9434946345f63bd980f80d7960dbd |
|
BLAKE2b-256 | 356512064861a4fae9c78d1d3e83606fc508081e0b0f9b05d5d2abb89d23a647 |
File details
Details for the file lets_plot-1.3.0rc1-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.3.0rc1-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.7m, macOS 10.9+ x86-64
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cab2aacf1f10c00611f41c75be2fb9892a8b56219b75679d44f52b9f9ccfca86 |
|
MD5 | bc6fa0c6a33f01322cf3d9223b26a165 |
|
BLAKE2b-256 | 185e95b26f37c0324af6b254dea8eb38adf01a5a84fc4d20744841f7dca760af |
File details
Details for the file lets_plot-1.3.0rc1-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: lets_plot-1.3.0rc1-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9866dbaee122c2ef449166c135b797fea8299330da12c5d5b49a4610ff55524 |
|
MD5 | bcf8487074f1516a75e471b8ed73733b |
|
BLAKE2b-256 | 28f7cacf92581a7bf9990b86e0d3b59056e6c34703837aeaf9b202228bee4714 |
File details
Details for the file lets_plot-1.3.0rc1-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.3.0rc1-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 4.9 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/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 469f6fcdd1a39b238efbc34b916ff158a7ddc56301c9bc52b5ecc2fb2b2a24f5 |
|
MD5 | 087233ae5011fac367df0b533f5a9da9 |
|
BLAKE2b-256 | b7f26176ff7e60dc9ac55b6b979bd02355154a75756d4b6a20b1367f660bc041 |
File details
Details for the file lets_plot-1.3.0rc1-cp36-cp36m-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.3.0rc1-cp36-cp36m-macosx_10_7_x86_64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.6m, macOS 10.7+ x86-64
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6bb116173763310b2ec1d82d70697aee8f1babbed083e2d714e7043f06829ed |
|
MD5 | bf4e0893e055ce65cc18e0c4f5ffa2df |
|
BLAKE2b-256 | f949675fe385b497bbb28a978963dfb34aec35c887c91fee9239c28759600b4d |