Skip to main content

Plot big data with Python.

Project description

LensPy: Plot millions of data points

Documentation Status PyPI PyPI - License

LensPy extends Plotly's Dash to allow you to plot very large datasets (millions of points) while ensuring that figures are still fast, fluid, and responsive.

alt text

This is achieved by adjusting the visible data based on the position of the viewport and how zoomed in the figure is. When you're zoomed out, only a subset of the data is shown. When you zoom in, LensPy will render more detail in your plot. By doing this, LensPy can build dynamic figures of very large datasets without overwhelming the browser when viewing the figures.

Contents

Features

  • Ability to specify number of points to display at once
  • Ability to define a custom function for downsampling data
  • Ability to run in Jupyter notebooks
  • Ability to use with Dash applications

Installation

Install LensPy using pip

pip install lenspy

Getting Started

Use LensPy by passing any Figure to the DynamicPlot constructor.

import numpy as np
import plotly.graph_objects as go
from lenspy import DynamicPlot

# First, let's create a very large figure
x = np.arange(1, 11, 1e-6)
y = 1e-2*np.sin(1e3*x) + np.sin(x) + 1e-3*np.sin(1e10*x)
fig = go.Figure(data=[go.Scattergl(x=x, y=y)])
fig.update_layout(title=f"{len(x):,} Data Points.")

# Use DynamicPlot.show to view the plot
plot = DynamicPlot(fig)
plot.show()

# Plot will be available in the browser at http://127.0.0.1:8050/

alt text

You can still access any of the Plotly Figure methods/attributes and modify them as needed.

Jupyter

LensPy starts a Flask web server, therefore plots won't be rendered in your notebook as widget. You can always access your plot in a seperate tab (default url is http://127.0.0.1:8050/)

Advanced Usage

For the full reference and detailed information, please see the documentation.

License

Copyright (c) 2020 Seran Thirugnanam under the MIT License.

Contributing

Help is always welcome. Feel free to open issues or PRs if there is a feature missing, or a bug to be addressed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lenspy-1.1.0.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

lenspy-1.1.0-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

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