An open source library for statistical plotting
Project description
Lets-Plot for Python
Latest Release | |
License | |
OS | Linux, MacOS, Windows |
Python versions | 3.6, 3.7, 3.8 |
- Overview
- Installation
- Quick start with Jupyter
- Example Notebooks
- GGBunch
- Data Sampling
- Export to File
- Cloud Notebooks
- Geospatial
- Interesting Demos
- Offline Mode
- Scientific Mode in IntelliJ IDEA / PyCharm
- What is new in 1.5.3
- Change Log
- License
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
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')
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
Cloud Notebooks
Examples:
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.
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.
Interesting Demos
A set of interesting notebooks using Lets-Plot
library for visualization.
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)
Scientific mode in IntelliJ IDEA / PyCharm
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.
What is new in 1.5.3
-
Tooltip Customization
New API for customization of tooltip contents and its position (see Tooltip Customization).
-
Attribution when Configuring 3-rd Party Map-tiles
New arguments in the
maptiles_zxy()
function allowing configuring attributions when using 3-rd party map-tiles as a base-map layer. -
Formatting lables in
geom_text()
New parameter, 'label_format' to define a formatting pattern.
See demo: label_format.ipynb
-
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: export_SVG_HTML
-
Fixed 'HUE' Scale and Other Fixes
See CHANGELOG.md for 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
Built Distributions
File details
Details for the file lets_plot-1.5.3-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: lets_plot-1.5.3-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.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63b5d5d02d80764b82356d20a5b326b3a7a9438cdce4e29e127278c58917a8e8 |
|
MD5 | 4405a735ef7a4c06a620f8a1b37b63ea |
|
BLAKE2b-256 | 879c952ca2b5da954d8176e8fabb398a351806cf3c66eddd8bd52ea31292fcf8 |
File details
Details for the file lets_plot-1.5.3-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.5.3-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 2.7 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | f447f840d8333f53f13333134cc15974cdfbfcf70f1ef36ff2e50c4dae8fa5f3 |
|
MD5 | 650666d9d24d5bfabbaaca4a790d3bf9 |
|
BLAKE2b-256 | 2663de62058f2a697cd7a2d6d9cb3e98514cff0a61cd5b0fb4eb366fa79da0ef |
File details
Details for the file lets_plot-1.5.3-cp38-cp38-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.5.3-cp38-cp38-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b782e8781214a7a35ee9422210bc8a91b41f29554b0d4bffd4c4183f0836f2d |
|
MD5 | 01e11a424a272da5ce7d85c293a92bcf |
|
BLAKE2b-256 | 1d0e698c636c764bde960ba454cfc79ccd049d36cc7099d2eb176997153ad378 |
File details
Details for the file lets_plot-1.5.3-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: lets_plot-1.5.3-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.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76a8e80ab1b4281b0816b1e07999dba5486e260a5631c6bf275c34f396959d26 |
|
MD5 | 15c8709ba6b78a136239661c8297a1e1 |
|
BLAKE2b-256 | 9e0ebfb9815e237f0f3405f4a171c36a8a12a01f57c31fd0f5357f5c5b0e72c3 |
File details
Details for the file lets_plot-1.5.3-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.5.3-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 2.7 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4e82ded638017e02c21b6381353a4c93937ec10cb182c008445be9d3651d236 |
|
MD5 | 87b1e0ebb55bbfa7fea2a09331619e92 |
|
BLAKE2b-256 | ce5ac656b542f5b6e0f149006f122fc562ccd2200f9f3533460cdf31b6758271 |
File details
Details for the file lets_plot-1.5.3-cp37-cp37m-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.5.3-cp37-cp37m-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3b47752e560aa35a404f19e05cda201c072e55d18cb40865746a25473aaee86 |
|
MD5 | 74256314d96d39fc10a4797f9af4b73d |
|
BLAKE2b-256 | c50f84b5dac6c2bf3731f8e01ed36a615e2424708fe55b405f1b12ea62de730a |
File details
Details for the file lets_plot-1.5.3-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: lets_plot-1.5.3-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.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8d79c856d861f2db2a2db957edcb1cff1982f490713da654c5ee65fe4a4c65e |
|
MD5 | e02bef88166b51777f274cee3cb78965 |
|
BLAKE2b-256 | 96a07c878c6ae606f713d07ca61c61db88cdf4a644a416434a2b01291f798019 |
File details
Details for the file lets_plot-1.5.3-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.5.3-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 2.7 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33ebd9ca513f8e63062490dacbda275fe71ecad8be3af9bd420e420887543ad0 |
|
MD5 | dc669708cab10d3ce63fa337f29c8bae |
|
BLAKE2b-256 | c6350ea857eb492d63e3c8bf0b436183cdcb5db1994d4d9e461dadb8c88b07f5 |
File details
Details for the file lets_plot-1.5.3-cp36-cp36m-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: lets_plot-1.5.3-cp36-cp36m-macosx_10_7_x86_64.whl
- Upload date:
- Size: 2.6 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ca8a678bfd977eb5a5f908f8edeaf0d97aca4647543bbb9eb9840e8ca2413f1 |
|
MD5 | 808d43222fc641695e84dfde512a57e3 |
|
BLAKE2b-256 | ba10069f6ca9e16ad8f7d9c21a30c02d2039a5be9e98cb14910fc2bfca200d3b |