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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file lenspy-1.1.0.tar.gz.

File metadata

  • Download URL: lenspy-1.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.1

File hashes

Hashes for lenspy-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6fbd19963b64d2556ba3d78cf245f2681f711788409ba5deca868b5a80614876
MD5 70b64391e2dd3f19432f326e4e59c85a
BLAKE2b-256 3c81aee98f9881419372f7a253b1c5ad642c8616b87136dbf8d2a063af94f0de

See more details on using hashes here.

File details

Details for the file lenspy-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: lenspy-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.1

File hashes

Hashes for lenspy-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ddeb9ad9431a77e8169780deda13f86c74dfcc757dbaa862a6151307f542c1d
MD5 e465b68e975ba9851295b50339541760
BLAKE2b-256 7b9a4a5fa7ff0541e78be69ffd2e078021a7d3251cc4d49dc886b215d31cbf41

See more details on using hashes here.

Supported by

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