An Open-source Plotting Library for Statistical Data¶
Python versions: 3.7-3.11
OS: Linux, macOS, Windows
pip install lets-plot
1import numpy as np 2from lets_plot import * 3LetsPlot.setup_html() 4 5np.random.seed(12) 6data = dict( 7 cond=np.repeat(['A', 'B'], 200), 8 rating=np.concatenate((np.random.normal(0, 1, 200), np.random.normal(1, 1.5, 200))) 9) 10 11ggplot(data, aes(x='rating', fill='cond')) + ggsize(700, 300) + \ 12 geom_density(color='dark_green', alpha=.7) + scale_fill_brewer(type='seq') + \ 13 theme(panel_grid_major_x='blank')
Meet the Grammar of Graphics¶
Lets-Plot API is largely based on the API provided by ggplot2 package well-known to data scientists who use R.
To learn more about the grammar of graphics, we recommend an excellent book called “ggplot2: Elegant Graphics for Data Analysis”. This will be a good prerequisite for further exploration of the Lets-Plot library.
Explore Your Data with Lets-Plot¶
You can customize the content, values formatting and appearance of tooltip for any geometry layer in your plot. Learn more.
Lets-Plot supports formatting of numeric and date-time values in tooltips, legends, on the axes and text geometry layer. Learn more.
R, Python, what’s next? Right. Lets-Plot Kotlin API enables data visualization in JVM and Kotlin/JS applications as well as in scientific notebooks like Jupyter and Datalore.
Sampling is a special technique of data transformation, which helps to deal with large datasets and overplotting. Learn more.
Export to SVG, HTML and PNG
ggsave() function is an easy way to export plot to a file in SVG, HTML or PNG formats. Learn more.
Interactive maps allow zooming and panning around your geospatial data with customizable vector or raster basemaps as a backdrop. Learn more.
offline=True will be working without an Internet connection. Learn more.