Skip to main content

Matplotlib Dynamic Downsampler

High Performance Time-Series Visualization

A python package for universal data downsampling and interactive visualization using Matplotlib and tsdownsampler.

matplotlib_resampler improves scalability of Matplotlib for visualizing massive time-series datasets. The library dynamically resamples time-series data respective to the current graph view, ensuring fast, responsive updates during panning or zooming.

This aggregation functionality is achieved by utilizing highly optimized data point selection algorithms from tsdownsample. Our default data aggregation method is MinMaxLTTB (defaulting to 5,000 points per view), which guarantees maximum visual fidelity and preserves narrow data spikes.

This works with more than 1 plot and can visualize over 1 Billion data points.

Features

  • Convenient and "Plug & Play": Just pass your existing plt object to our class constructor. Preserves all original Matplotlib styling, colors, labels and figure configurations.
  • No Backend Servers Required: Requires zero web servers, Dash apps, or Jupyter widget overhead. Runs entirely via Matplotlib's native event backend.
  • Efficient visualization of large datasets: Dynamic zooming in and out while keeping high fidelity based on user's point preference.

Installation

Clone the repository: git clone https://github.com/JGPOG/matplotlib_resampler.git

Install the package: pip install matplotlib_resampler\dist\matplotlib_resampler-0.1.0-py3-none-any.whl

Usage

Add dynamic aggregation to your figure with minimal overhead.

import matplotlib.pyplot as plt
import numpy as np
from matplotlib_resampler import DynamicDownsampler

plt.figure(figsize=(10, 5))
plt.plot(t, signal, label="Noisy 1 Hz Sine Wave")

plt.title("1 Hz Noisy Sine Wave with 10 Random Spikes")
plt.xlabel("Time (s)")
plt.ylabel("Amplitude")
plt.grid(True, linestyle="--", alpha=0.6)
plt.legend(loc="upper right")
plt.tight_layout()
# Simply call the class and place the object
DynamicDownsampler(plt)
plt.show()

In example demo, 200,000,000 data points across 4 subplots (50M each) are visualized!

Matplotlib Standalone vs Matplotlib + Resampler

DynamicDownsampler() acts as an invisible wrapper around standard Matplotlib figures. It adds visualization scalability to line charts by resampling the data based on GUI zoom or pan events.

  • Standard Matplotlib attempts to render more points than the computer may be capable of handling.
  • matplotlib_enhancer intercepts these points before rendering and only plots a mathematically representative downsampled version. When you zoom in, it automatically recalculates and reveals the high resolution details for that window.

Important Considerations & Tips

  • Sorting Requirement: The underlying tsdownsample Rust engine requires your X-axis data to be monotonic/sorted and free of NaN values.
  • Aliasing and Signal Spikes: MinMaxLTTB ensures extreme peaks and troughs in raw data are never accidentally skipped when rendering a zoomed out view.
  • None Networked/Portable Installations: If you have installed using a non networked or portable folder, there is a chance you receive an error about the figure not being interactive and it won't plot. In this case you need to install PyQt6.

Release files for matplotlib-resampler 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matplotlib-resampler 0.1.1
File Size Uploaded
matplotlib_resampler-0.1.1.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for matplotlib-resampler 0.1.1
File Interpreter ABI Platform
matplotlib_resampler-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 kB

Release files / matplotlib_resampler-0.1.1.tar.gz

Download URL matplotlib_resampler-0.1.1.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9aa8902324ceecde5a31fe48a8361b76747773e0669bb10a073854591b960e07
BLAKE2b-256 checksum
How to use checksums
77e57b62eb3ca7c5850e9f9955f97fd9d7d8fe50de3fa82a2e3292ac338808d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release files / matplotlib_resampler-0.1.1-py3-none-any.whl

Download URL matplotlib_resampler-0.1.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bbe026343702829bf625487f0ba49b8f6a7a39f564bf53b5b1e7d19b631f28a7
BLAKE2b-256 checksum
How to use checksums
b9d170e09997a29ff288a17f47fc1f4e6991a36003b551c0a380cd3b4d74bcf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page