An open source library for statistical plotting
Lets-Plot for Python
|Python versions||3.7, 3.8|
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.
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 functions and built-in sampling 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.
To install the Lets-Plot library, run the following command:
pip install lets-plot
Quickstart in 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')
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
Unfamiliar functions used in the examples
ggsize()- sets size of the plot. Used in many examples starting from
geom_density2df()- fills space between equal density lines on 2D density plot. Similar to
geom_contourf()- fills space between lines of equal level of bivariate function. Similar to
Sampling is a special technique of data transformation, which helps dealing with large datasets and overplotting.
Learn more about sampling in Lets-Plot.
Code and documentation released under the MIT license. Copyright 2019, JetBrains s.r.o.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size lets_plot-1.0.0-cp37-cp37m-macosx_10_9_x86_64.whl (2.7 MB)||File type Wheel||Python version cp37||Upload date||Hashes View hashes|
|Filename, size lets_plot-1.0.0-cp37-cp37m-manylinux1_x86_64.whl (3.0 MB)||File type Wheel||Python version cp37||Upload date||Hashes View hashes|
|Filename, size lets_plot-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl (2.7 MB)||File type Wheel||Python version cp38||Upload date||Hashes View hashes|
|Filename, size lets_plot-1.0.0-cp38-cp38-manylinux1_x86_64.whl (3.0 MB)||File type Wheel||Python version cp38||Upload date||Hashes View hashes|
Hashes for lets_plot-1.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
Hashes for lets_plot-1.0.0-cp37-cp37m-manylinux1_x86_64.whl
Hashes for lets_plot-1.0.0-cp38-cp38-macosx_10_9_x86_64.whl
Hashes for lets_plot-1.0.0-cp38-cp38-manylinux1_x86_64.whl