quatplot
Interactive 3D plots for Jupyter with quaternion-based view controls — no gimbal lock.
Quaternion math is powered by ganja.js
(Algebra(0,2) ≅ ℍ) when its CDN is reachable, with a built-in quaternion
fallback otherwise. Rendering is plain HTML5 canvas inside an <iframe srcdoc>,
so plots are self-contained: multiple plots per notebook can't collide on IDs,
CSS, or globals, and no notebook-side JavaScript is required.
Features
- Surface plots from 2D mesh data (colored fill and/or wireframe, toggleable)
- 3D scatter plots with colored markers and hover coordinate tooltips
- Optional color bar for scatter values
- Isometric ⇄ perspective projection toggle
- Plotly-style mouse controls: drag to rotate, wheel to zoom, shift-drag / right-drag to pan
- Top view button (straight down, x right / y up — isometric top view reads as a 2D plot)
- Auto-scaled, labeled axes with nice-number tick marks
- Light / dark themes; Viridis, Plasma, Jet, Coolwarm, Grayscale colormaps
- PNG screenshot button
- Resizable plots in Jupyter: drag the bottom-right corner
- Standalone HTML export
Install
pip install quatplot
Or the latest development version straight from GitHub:
pip install git+https://github.com/drscotthawley/quatplot.git
Usage
import numpy as np
import quatplot as qp
x = np.linspace(-3, 3, 41)
y = np.linspace(-3, 3, 41)
X, Y = np.meshgrid(x, y)
Z = np.sin(X) * np.cos(Y)
qp.plot(qp.Surface(x, y, Z)) # in a notebook cell
qp.plot(qp.Scatter3(px, py, pz, v=values), # scatter, colored by v
colorbar=True, cmap="Plasma")
qp.plot(qp.Surface(x, y, Z), qp.Scatter3(px, py, pz), # overlay traces
theme="light", proj="perspective", height=600)
qp.save("plot.html", qp.Surface(x, y, Z)) # standalone HTML file
plot() options: theme ("dark"/"light"), proj ("iso"/"perspective"),
cmap, fill, wire, colorbar, height (initial px; plots are
corner-drag resizable afterward).
See the demo notebook for a working tour.
Screenshot
Development
git clone https://github.com/drscotthawley/quatplot.git
cd quatplot
pip install -e .
The entire library is one file, quatplot.py; the HTML/JS template embedded in
it is the single source of truth for both notebook rendering and HTML export.
License
MIT — see LICENSE.
Metadata
Release files for quatplot 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| quatplot-0.1.4.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| quatplot-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.4 kB
Release files / quatplot-0.1.4.tar.gz
| Download URL | quatplot-0.1.4.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0de7bed224ec0dcf2428f46f0a6c409655bd503761c92db95a5a7c4d400de3c4
|
|
BLAKE2b-256 checksum How to use checksums |
fcbcd603b02575e2f0ca5394311bc303a90ccf956cc4270ce16c6728a4323838
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.18
|
Release files / quatplot-0.1.4-py3-none-any.whl
| Download URL | quatplot-0.1.4-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1de4e8dabadb3b10a3bc6d09eae1183dfeecc8a7a44737e4c68add85ab8fcba2
|
|
BLAKE2b-256 checksum How to use checksums |
81047289304385baf55fb9157769a739f50369b6538f256a6b166c98b1d65d9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.18
|