Metadata-Version: 2.4
Name: quatplot
Version: 0.1.3
Summary: Interactive 3D plots for Jupyter with quaternion-based view controls (ganja.js) - no gimbal lock
Author: Scott H. Hawley
License: MIT License
        
        Copyright (c) 2026 Scott H. Hawley
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/drscotthawley/quatplot
Project-URL: Issues, https://github.com/drscotthawley/quatplot/issues
Keywords: plotting,3d,jupyter,quaternion,visualization,ganja
Classifier: Framework :: Jupyter
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Dynamic: license-file

# quatplot

Interactive 3D plots for Jupyter with quaternion-based view controls — no gimbal lock.

Quaternion math is powered by [ganja.js](https://github.com/enkimute/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

```bash
pip install quatplot
```

Or the latest development version straight from GitHub:

```bash
pip install git+https://github.com/drscotthawley/quatplot.git
```

## Usage

```python
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](https://github.com/drscotthawley/quatplot/blob/main/examples/quatplot_demo.ipynb)
for a working tour.

## Development

```bash
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](https://github.com/drscotthawley/quatplot/blob/main/LICENSE).

