Natural extensions to Matplotlib for multidimensional plotting.
Project description
Matplotlib-extensions
Repository extending standard matplotlib functionality (typically) to higher dimensions with convenient and intuitive APIs. Higher dimensions can mean e.g. including time, color or multiple figure axes.
Extended functions:
time_scatter
time_scatter extends plt.scatter(x, y, OPTIONAL: z) to accept temporally dependent spatial samples x(t), y(t), OPTIONAL: z(t) and animates it. The arguments to time_scatter, thus, has shape shape(x(t)) = (N,T), compared to the purely spatial samples of scatter with shape shape(x) = (N,).
import numpy as np
from sklearn.datasets import make_swiss_roll
# sample some data (shape: (200,2))
data = make_swiss_roll(200, noise=0.1)[0][:, [0, 2]]
# sort data based on radial distance to origin
idxs = np.argsort(np.linalg.norm(data, axis=1))
data = data[idxs]
# Regular 2D scatter plot of data
fig, ax = plt.subplots(figsize=(3,3))
ax.scatter(*data.T, alpha=0.2)
# Plot the same data, but over time using time_scatter
# the shape of data.T[:,None] is (2,1,200)
# meaning we display each sample at distinct timepoints
from mplextensions import time_scatter
html = time_scatter(*data.T[:,None], fps=24, fig=fig, ax=ax)
html # show animation a notebook
multi_imshow
extends matplotlib's imshow plotting many images on a square grid. Simply send a tensor zz of dimensions (Nimages, H, W) which contains Nimages with height H and width W. Calling the function as: multiimshow(zz) will plot all the images on a square grid.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file matplotlib_extensions-0.1.0.tar.gz.
File metadata
- Download URL: matplotlib_extensions-0.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
451391b994db922ad5c584947c26216e3d06ceafa750ccfac8765766004143d9
|
|
| MD5 |
85c11cf3b31be52616ff05198d25084b
|
|
| BLAKE2b-256 |
a90885f0ff4b7283c10460c4e3b79615c51c199814b2e589fb7626436531d8c5
|
File details
Details for the file matplotlib_extensions-0.1.0-py3-none-any.whl.
File metadata
- Download URL: matplotlib_extensions-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be22b144306efe60ebdf425f7842f1ebab285d5042000f895e532796d98183ca
|
|
| MD5 |
066e4079fc361663e9cf41ed7f4f5fd6
|
|
| BLAKE2b-256 |
8e5dc612c8f8833965b51f4b6f82883511673d38771bd5c488ba951ffd0bd19a
|