rustplotlib 2.0.0__tar.gz → 4.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rustplotlib-4.0.0/CONTRIBUTING.md +195 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/Cargo.lock +1 -1
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/Cargo.toml +1 -1
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/PKG-INFO +78 -17
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/README.md +77 -16
- rustplotlib-4.0.0/ROADMAP.md +190 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/pyproject.toml +1 -1
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/patches.py +32 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/pyplot.py +839 -90
- rustplotlib-4.0.0/python/rustplotlib/ticker.py +194 -0
- rustplotlib-4.0.0/src/artists/arrow.rs +162 -0
- rustplotlib-4.0.0/src/artists/bar.rs +397 -0
- rustplotlib-4.0.0/src/artists/fill_polygon.rs +108 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/image.rs +210 -109
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/line2d.rs +6 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/mod.rs +9 -0
- rustplotlib-4.0.0/src/artists/pcolormesh.rs +193 -0
- rustplotlib-4.0.0/src/artists/sankey.rs +193 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/scatter.rs +6 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/axes.rs +390 -20
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/colors.rs +14 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/figure.rs +369 -13
- rustplotlib-4.0.0/tests/test_new_features2.py +332 -0
- rustplotlib-4.0.0/tests/test_phase9_features.py +455 -0
- rustplotlib-4.0.0/tests/test_spectral_features.py +441 -0
- rustplotlib-4.0.0/tests/test_v3_features.py +312 -0
- rustplotlib-2.0.0/ROADMAP.md +0 -171
- rustplotlib-2.0.0/python/rustplotlib/ticker.py +0 -23
- rustplotlib-2.0.0/src/artists/bar.rs +0 -175
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/.github/workflows/ci.yml +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/.gitignore +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/LICENSE +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/dados/Data/PerfisTemp_rustplotlib.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/__init__.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/animation.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/axes/__init__.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/backends/__init__.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/backends/backend_inline.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/backends/backend_pdf.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/cm.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/collections.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/colors.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/cycler.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/dates.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/figure.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/font_manager.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/gridspec.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/lines.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/mpl_toolkits/__init__.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/mpl_toolkits/mplot3d/__init__.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/patheffects.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/pyplot.pyi +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/spines.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/style/__init__.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/text.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/transforms.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/python/rustplotlib/widgets.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/bar3d.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/barh.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/boxplot.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/broken_barh.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/contour.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/contour3d.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/errorbar.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/eventplot.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/fill_between.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/fill_betweenx.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/hexbin.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/hist.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/legend.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/line3d.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/patches.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/pie.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/quiver.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/radar.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/scatter3d.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/stem.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/step.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/streamplot.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/surface3d.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/trisurf3d.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/violin.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/artists/wireframe3d.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/axes3d.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/fonts/DejaVuSans.ttf +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/lib.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/projection3d.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/svg_renderer.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/text.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/ticker.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/transforms.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/src/window.rs +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/tests/test_3d.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/tests/test_benchmark.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/tests/test_colors.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/tests/test_figure.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/tests/test_new_features.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/tests/test_phase6_7.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/tests/test_phase8.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/tests/test_pyplot.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/tests/test_ticker.py +0 -0
- {rustplotlib-2.0.0 → rustplotlib-4.0.0}/tests/test_transforms.py +0 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Contributing to RustPlotLib
|
|
2
|
+
|
|
3
|
+
Thanks for wanting to help rebuild matplotlib in Rust! This guide will help you get started quickly.
|
|
4
|
+
|
|
5
|
+
## How to Pick a Task
|
|
6
|
+
|
|
7
|
+
1. Open [ROADMAP.md](ROADMAP.md) — every unchecked `[ ]` item is up for grabs
|
|
8
|
+
2. Open a GitHub Issue saying "I'm working on [feature]" to avoid duplicate work
|
|
9
|
+
3. Features are organized by priority version (v3, v4, v5, v6)
|
|
10
|
+
|
|
11
|
+
**Best first contributions:**
|
|
12
|
+
- Any item in the **v3.0.0** section (formatters, locators, missing plots)
|
|
13
|
+
- Bug fixes and edge cases
|
|
14
|
+
- Improving existing stubs (turning them into real implementations)
|
|
15
|
+
|
|
16
|
+
## Project Structure
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
rustplotlib/
|
|
20
|
+
├── src/ # Rust core (this is where the rendering happens)
|
|
21
|
+
│ ├── lib.rs # PyO3 module registration
|
|
22
|
+
│ ├── figure.rs # Figure + PyO3 bindings (savefig, render, etc.)
|
|
23
|
+
│ ├── axes.rs # Axes (2D plotting area, ~1500 lines)
|
|
24
|
+
│ ├── axes3d.rs # Axes3D (3D plotting)
|
|
25
|
+
│ ├── projection3d.rs # 3D camera + projection math
|
|
26
|
+
│ ├── transforms.rs # Data coords → pixel coords
|
|
27
|
+
│ ├── colors.rs # Color parsing (named, hex, RGB, RGBA)
|
|
28
|
+
│ ├── text.rs # Text rendering (ab_glyph + DejaVu Sans font)
|
|
29
|
+
│ ├── ticker.rs # Auto-tick computation
|
|
30
|
+
│ ├── svg_renderer.rs # Native SVG output
|
|
31
|
+
│ ├── window.rs # Interactive window (winit + softbuffer)
|
|
32
|
+
│ └── artists/ # One file per plot type
|
|
33
|
+
│ ├── mod.rs # Artist trait definition
|
|
34
|
+
│ ├── line2d.rs # plot()
|
|
35
|
+
│ ├── scatter.rs # scatter()
|
|
36
|
+
│ ├── bar.rs # bar()
|
|
37
|
+
│ ├── hist.rs # hist()
|
|
38
|
+
│ ├── image.rs # imshow() + colormaps
|
|
39
|
+
│ ├── contour.rs # contour/contourf
|
|
40
|
+
│ ├── surface3d.rs # plot_surface()
|
|
41
|
+
│ ├── ... (31 total)
|
|
42
|
+
│ └── legend.rs # Legend rendering
|
|
43
|
+
│
|
|
44
|
+
├── python/rustplotlib/ # Python API layer
|
|
45
|
+
│ ├── __init__.py # Package exports
|
|
46
|
+
│ ├── pyplot.py # Main API (drop-in replacement for matplotlib.pyplot)
|
|
47
|
+
│ ├── style/__init__.py # Style themes (dark_background, ggplot, etc.)
|
|
48
|
+
│ ├── animation.py # FuncAnimation + GIF export
|
|
49
|
+
│ ├── ticker.py # Formatters and Locators
|
|
50
|
+
│ ├── dates.py # Date handling
|
|
51
|
+
│ ├── ... (23 modules total)
|
|
52
|
+
│ └── mpl_toolkits/mplot3d/ # 3D axes support
|
|
53
|
+
│
|
|
54
|
+
├── tests/ # Python tests
|
|
55
|
+
│ ├── test_colors.py
|
|
56
|
+
│ ├── test_figure.py
|
|
57
|
+
│ ├── test_pyplot.py
|
|
58
|
+
│ ├── test_3d.py
|
|
59
|
+
│ ├── test_benchmark.py
|
|
60
|
+
│ └── ... (200+ tests)
|
|
61
|
+
│
|
|
62
|
+
├── Cargo.toml # Rust dependencies
|
|
63
|
+
├── pyproject.toml # Python package config (maturin)
|
|
64
|
+
├── README.md # Project documentation
|
|
65
|
+
├── ROADMAP.md # Feature roadmap with checkboxes
|
|
66
|
+
└── CONTRIBUTING.md # This file
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## How to Add a New Plot Type
|
|
70
|
+
|
|
71
|
+
Example: adding `spy()` (sparsity pattern)
|
|
72
|
+
|
|
73
|
+
### Option A: Pure Python (simple cases)
|
|
74
|
+
If the new plot can be built on top of existing Rust functions:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
# In python/rustplotlib/pyplot.py, add to AxesProxy:
|
|
78
|
+
def spy(self, Z, precision=0, **kwargs):
|
|
79
|
+
import numpy as np
|
|
80
|
+
Z = np.asarray(Z)
|
|
81
|
+
mask = np.abs(Z) > precision
|
|
82
|
+
self.imshow(mask.astype(float), cmap='gray_r', **kwargs)
|
|
83
|
+
self.set_aspect('equal')
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Option B: Rust Implementation (performance-critical)
|
|
87
|
+
For new rendering that needs to be fast:
|
|
88
|
+
|
|
89
|
+
**1. Create the artist** (`src/artists/my_plot.rs`):
|
|
90
|
+
```rust
|
|
91
|
+
use crate::artists::Artist;
|
|
92
|
+
use crate::colors::Color;
|
|
93
|
+
use crate::transforms::Transform;
|
|
94
|
+
|
|
95
|
+
pub struct MyPlot {
|
|
96
|
+
pub data: Vec<f64>,
|
|
97
|
+
pub color: Color,
|
|
98
|
+
pub label: Option<String>,
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
impl Artist for MyPlot {
|
|
102
|
+
fn draw(&self, pixmap: &mut tiny_skia::Pixmap, transform: &Transform) {
|
|
103
|
+
// Draw using tiny-skia
|
|
104
|
+
}
|
|
105
|
+
fn data_bounds(&self) -> (f64, f64, f64, f64) {
|
|
106
|
+
// Return (xmin, xmax, ymin, ymax)
|
|
107
|
+
}
|
|
108
|
+
fn legend_label(&self) -> Option<&str> { self.label.as_deref() }
|
|
109
|
+
fn legend_color(&self) -> Color { self.color }
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**2. Register in** `src/artists/mod.rs`:
|
|
114
|
+
```rust
|
|
115
|
+
pub mod my_plot;
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**3. Add method to Axes** (`src/axes.rs`):
|
|
119
|
+
```rust
|
|
120
|
+
pub fn my_plot(&mut self, data: Vec<f64>, color: Option<Color>) {
|
|
121
|
+
let c = color.unwrap_or_else(|| self.next_color());
|
|
122
|
+
self.artists.push(Box::new(my_plot::MyPlot { data, color: c, label: None }));
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**4. Add PyO3 binding** (`src/figure.rs`):
|
|
127
|
+
```rust
|
|
128
|
+
fn axes_my_plot(&mut self, ax_id: usize, data: Vec<f64>, kwargs: &Bound<'_, PyDict>) -> PyResult<()> {
|
|
129
|
+
let ax = self.axes.get_mut(ax_id).ok_or_else(|| ...)?;
|
|
130
|
+
let color = if let Some(c) = kwargs.get_item("color")? { Some(parse_color_value(&c)?) } else { None };
|
|
131
|
+
ax.my_plot(data, color);
|
|
132
|
+
Ok(())
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**5. Add Python wrapper** (`python/rustplotlib/pyplot.py`):
|
|
137
|
+
```python
|
|
138
|
+
# In AxesProxy:
|
|
139
|
+
def my_plot(self, data, **kwargs):
|
|
140
|
+
self._fig.axes_my_plot(self._id, _to_list(data), kwargs)
|
|
141
|
+
|
|
142
|
+
# Module level:
|
|
143
|
+
def my_plot(data, **kwargs):
|
|
144
|
+
_gca().my_plot(data, **kwargs)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**6. Add test** (`tests/test_my_plot.py`):
|
|
148
|
+
```python
|
|
149
|
+
def test_my_plot():
|
|
150
|
+
import rustplotlib.pyplot as plt
|
|
151
|
+
plt.my_plot([1, 2, 3])
|
|
152
|
+
plt.savefig("/tmp/test_my_plot.png")
|
|
153
|
+
plt.close()
|
|
154
|
+
import os
|
|
155
|
+
assert os.path.exists("/tmp/test_my_plot.png")
|
|
156
|
+
os.remove("/tmp/test_my_plot.png")
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Development Setup
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Clone
|
|
163
|
+
git clone https://github.com/Thi4gon/rustplotlib.git
|
|
164
|
+
cd rustplotlib
|
|
165
|
+
|
|
166
|
+
# Setup (requires Rust and Python 3.9+)
|
|
167
|
+
python -m venv .venv
|
|
168
|
+
source .venv/bin/activate # or .venv\Scripts\activate on Windows
|
|
169
|
+
pip install maturin numpy pytest
|
|
170
|
+
|
|
171
|
+
# Build
|
|
172
|
+
maturin develop
|
|
173
|
+
|
|
174
|
+
# Test
|
|
175
|
+
pytest tests/ -v
|
|
176
|
+
|
|
177
|
+
# Build release (for benchmarks)
|
|
178
|
+
maturin develop --release
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Code Style
|
|
182
|
+
|
|
183
|
+
- **Rust:** standard rustfmt, no `unsafe`, proper error handling (no `.unwrap()` on user input)
|
|
184
|
+
- **Python:** keep it simple, follow existing patterns in pyplot.py
|
|
185
|
+
- **Tests:** every new feature needs at least one test
|
|
186
|
+
- **Security:** validate all inputs at PyO3 boundary, no path traversal, no panics
|
|
187
|
+
|
|
188
|
+
## PR Checklist
|
|
189
|
+
|
|
190
|
+
- [ ] All existing tests pass (`pytest tests/ -v`)
|
|
191
|
+
- [ ] New tests added for new features
|
|
192
|
+
- [ ] `maturin develop` compiles without errors
|
|
193
|
+
- [ ] No new warnings in Rust compilation
|
|
194
|
+
- [ ] README.md updated if adding user-facing features
|
|
195
|
+
- [ ] ROADMAP.md checkbox checked for completed items
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rustplotlib
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.0
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Intended Audience :: Science/Research
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -87,15 +87,16 @@ plt.show()
|
|
|
87
87
|
|
|
88
88
|
## What's Implemented
|
|
89
89
|
|
|
90
|
-
### 2D Plot Types (
|
|
90
|
+
### 2D Plot Types (40+ types)
|
|
91
91
|
| Function | Description |
|
|
92
92
|
|---|---|
|
|
93
|
-
| `plot()` | Line plots with color, linestyle, linewidth, markers, markevery, labels, alpha |
|
|
94
|
-
| `scatter()` | Scatter plots with per-point sizes, colors, markers, alpha |
|
|
95
|
-
| `bar()` / `barh()` | Vertical and horizontal bar charts (stacked
|
|
93
|
+
| `plot()` | Line plots with color, linestyle, linewidth, markers, markevery, labels, alpha, zorder |
|
|
94
|
+
| `scatter()` | Scatter plots with per-point sizes, colors, markers, alpha, zorder |
|
|
95
|
+
| `bar()` / `barh()` | Vertical and horizontal bar charts (stacked, hatch patterns, zorder) |
|
|
96
96
|
| `hist()` | Histograms with configurable bins |
|
|
97
|
-
| `imshow()` | Image/heatmap display with
|
|
97
|
+
| `imshow()` | Image/heatmap display with 70+ colormaps, bilinear interpolation, annotations |
|
|
98
98
|
| `fill_between()` / `fill_betweenx()` | Filled area between curves (vertical and horizontal) |
|
|
99
|
+
| `fill()` | Filled polygon from vertex arrays |
|
|
99
100
|
| `errorbar()` | Error bars with caps (xerr/yerr) |
|
|
100
101
|
| `step()` | Step plots (pre/post/mid) |
|
|
101
102
|
| `pie()` | Pie charts with labels |
|
|
@@ -106,8 +107,29 @@ plt.show()
|
|
|
106
107
|
| `hexbin()` | Hexagonal binning for 2D histograms |
|
|
107
108
|
| `quiver()` | Vector field arrows |
|
|
108
109
|
| `streamplot()` | Streamlines for vector fields (Euler integration) |
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
| `stackplot()` | Stacked area charts |
|
|
111
|
+
| `broken_barh()` | Broken horizontal bar charts |
|
|
112
|
+
| `eventplot()` | Event/raster plots |
|
|
113
|
+
| `pcolormesh()` / `pcolor()` | Pseudocolor plots for irregular grids |
|
|
114
|
+
| `matshow()` | Matrix display with integer ticks |
|
|
115
|
+
| `radar()` | Radar/spider charts |
|
|
116
|
+
| `sankey()` | Sankey flow diagrams |
|
|
117
|
+
| `spy()` | Sparsity pattern visualization |
|
|
118
|
+
| `stairs()` | Step-wise constant function with edges |
|
|
119
|
+
| `ecdf()` | Empirical cumulative distribution |
|
|
120
|
+
| `triplot()` | Triangulation edge drawing |
|
|
121
|
+
| `hist2d()` | 2D histogram heatmap |
|
|
122
|
+
| `specgram()` | Spectrogram (STFT-based) |
|
|
123
|
+
| `acorr()` / `xcorr()` | Auto/cross correlation |
|
|
124
|
+
| `psd()` | Power spectral density (Welch) |
|
|
125
|
+
| `magnitude_spectrum()` | FFT magnitude |
|
|
126
|
+
| `angle_spectrum()` / `phase_spectrum()` | FFT phase |
|
|
127
|
+
| `cohere()` / `csd()` | Coherence / cross spectral density |
|
|
128
|
+
| `semilogx()` / `semilogy()` / `loglog()` | Convenience log-scale plots |
|
|
129
|
+
| `arrow()` | Arrow drawing |
|
|
130
|
+
| `axline()` | Infinite line through point with slope |
|
|
131
|
+
|
|
132
|
+
### 3D Plot Types (7 types)
|
|
111
133
|
| Function | Description |
|
|
112
134
|
|---|---|
|
|
113
135
|
| `plot()` (3D) | 3D line plots |
|
|
@@ -115,6 +137,8 @@ plt.show()
|
|
|
115
137
|
| `plot_surface()` | 3D surface plots with colormaps |
|
|
116
138
|
| `plot_wireframe()` | 3D wireframe plots |
|
|
117
139
|
| `bar3d()` | 3D bar charts with shading |
|
|
140
|
+
| `plot_trisurf()` | 3D triangulated surface |
|
|
141
|
+
| `contour3D()` | 3D contour lines at Z offset |
|
|
118
142
|
|
|
119
143
|
### Layout & Figure
|
|
120
144
|
| Function | Description |
|
|
@@ -129,6 +153,9 @@ plt.show()
|
|
|
129
153
|
| `add_subplot(projection='3d')` | Add 3D subplot |
|
|
130
154
|
| `clf()` / `cla()` / `close()` | Clear and close figures |
|
|
131
155
|
| `gcf()` / `gca()` | Get current figure/axes |
|
|
156
|
+
| `subplot2grid()` | Subplot at specific grid position |
|
|
157
|
+
| `fig.add_gridspec()` | GridSpec from figure |
|
|
158
|
+
| `fig.legend()` | Figure-level legend |
|
|
132
159
|
|
|
133
160
|
### Axes Customization
|
|
134
161
|
| Function | Description |
|
|
@@ -145,7 +172,9 @@ plt.show()
|
|
|
145
172
|
| `axis('off')` | Hide axes completely |
|
|
146
173
|
| `set_facecolor()` | Axes background color |
|
|
147
174
|
| `spines['right'].set_visible(False)` | Spine customization |
|
|
148
|
-
| `twinx()` | Secondary y-axis |
|
|
175
|
+
| `twinx()` / `twiny()` | Secondary y-axis / x-axis |
|
|
176
|
+
| `zorder` | Drawing order control for all artists |
|
|
177
|
+
| `hatch` | Hatch patterns for bars (`/`, `\\`, `|`, `-`, `+`, `x`, `o`, `.`, `*`) |
|
|
149
178
|
| `legend()` | Legend with line+marker swatches and positioning |
|
|
150
179
|
| `grid()` | Grid lines with color, linewidth, linestyle, alpha, which |
|
|
151
180
|
| `text()` | Positioned text annotations |
|
|
@@ -155,6 +184,13 @@ plt.show()
|
|
|
155
184
|
| `axhspan()` / `axvspan()` | Shaded horizontal/vertical regions |
|
|
156
185
|
| `hlines()` / `vlines()` | Multiple reference lines with bounds |
|
|
157
186
|
| `colorbar()` | Color scale bar for imshow/contour |
|
|
187
|
+
| `get_xlim()` / `get_ylim()` | Get current axis limits (functional) |
|
|
188
|
+
| `clear()` | Clear all artists from axes |
|
|
189
|
+
| `ax.set(**kwargs)` | Set multiple properties at once |
|
|
190
|
+
| `minor=True` in set_xticks/yticks | Minor tick support |
|
|
191
|
+
| `bar_label()` | Value labels on bars |
|
|
192
|
+
| `set_xlabel(color=...)` | Label color customization |
|
|
193
|
+
| `title(loc='left')` | Title alignment |
|
|
158
194
|
|
|
159
195
|
### Output Formats
|
|
160
196
|
| Method | Description |
|
|
@@ -191,9 +227,13 @@ plt.show()
|
|
|
191
227
|
- **Format strings:** `"r--o"` = red + dashed + circle markers
|
|
192
228
|
- **markevery:** show marker every N points
|
|
193
229
|
|
|
194
|
-
### Colormaps (
|
|
230
|
+
### Colormaps (70+)
|
|
231
|
+
35 base colormaps + all reversed variants (`_r` suffix):
|
|
232
|
+
|
|
195
233
|
`viridis` `plasma` `inferno` `magma` `cividis` `twilight` `turbo` `hot` `cool` `gray` `jet` `spring` `summer` `autumn` `winter` `copper` `bone` `pink` `binary` `gist_heat` `ocean` `terrain` `Blues` `Reds` `Greens` `YlOrRd` `YlGnBu` `RdYlBu` `RdBu` `PiYG` `PRGn` `BrBG` `Spectral` `Set1` `Set2` `Set3` `Pastel1` `Pastel2` `tab20`
|
|
196
234
|
|
|
235
|
+
All also available as `viridis_r`, `plasma_r`, `hot_r`, etc.
|
|
236
|
+
|
|
197
237
|
### Text Rendering
|
|
198
238
|
- Embedded DejaVu Sans font (no system font dependency)
|
|
199
239
|
- LaTeX-to-Unicode conversion (`$\theta$` -> theta, `$x_1$` -> x1, Greek letters, sub/superscripts, math operators)
|
|
@@ -205,21 +245,31 @@ plt.show()
|
|
|
205
245
|
- **Dates:** `date2num()`, `num2date()`, date formatters and locators
|
|
206
246
|
- **Categorical axes:** string-based x values automatically converted
|
|
207
247
|
|
|
208
|
-
### Compatibility Modules
|
|
248
|
+
### Compatibility Modules (23 modules)
|
|
209
249
|
| Module | Status |
|
|
210
250
|
|---|---|
|
|
211
|
-
| `rustplotlib.pyplot` | Full implementation |
|
|
251
|
+
| `rustplotlib.pyplot` | Full implementation (50+ functions) |
|
|
212
252
|
| `rustplotlib.style` | Full implementation (6 themes) |
|
|
213
253
|
| `rustplotlib.animation` | FuncAnimation + GIF export |
|
|
214
254
|
| `rustplotlib.widgets` | Stubs (Slider, Button, CheckButtons, RadioButtons, TextBox, Cursor) |
|
|
215
|
-
| `rustplotlib.font_manager` | FontProperties
|
|
216
|
-
| `rustplotlib.ticker` | FormatStrFormatter
|
|
255
|
+
| `rustplotlib.font_manager` | FontProperties |
|
|
256
|
+
| `rustplotlib.ticker` | FormatStrFormatter |
|
|
217
257
|
| `rustplotlib.patches` | Rectangle, Circle, Polygon, FancyBboxPatch, Wedge |
|
|
218
258
|
| `rustplotlib.colors` | LinearSegmentedColormap, Normalize, LogNorm |
|
|
219
259
|
| `rustplotlib.dates` | Date conversion, formatters, locators |
|
|
220
260
|
| `rustplotlib.gridspec` | GridSpec, SubplotSpec |
|
|
221
|
-
| `rustplotlib.backends` | Backend system
|
|
261
|
+
| `rustplotlib.backends` | Backend system, PdfPages |
|
|
222
262
|
| `rustplotlib.mpl_toolkits.mplot3d` | Axes3D for 3D plotting |
|
|
263
|
+
| `rustplotlib.cm` | Colormap access by name |
|
|
264
|
+
| `rustplotlib.collections` | LineCollection, PathCollection, PatchCollection |
|
|
265
|
+
| `rustplotlib.lines` | Line2D with get/set methods |
|
|
266
|
+
| `rustplotlib.text` | Text, Annotation |
|
|
267
|
+
| `rustplotlib.transforms` | Bbox, Affine2D, BboxTransform |
|
|
268
|
+
| `rustplotlib.patheffects` | Stroke, withStroke, SimplePatchShadow |
|
|
269
|
+
| `rustplotlib.spines` | Spine |
|
|
270
|
+
| `rustplotlib.axes` | Axes class reference |
|
|
271
|
+
| `rustplotlib.figure` | Figure class reference |
|
|
272
|
+
| `rustplotlib.cycler` | cycler compatibility |
|
|
223
273
|
|
|
224
274
|
---
|
|
225
275
|
|
|
@@ -389,11 +439,22 @@ Contributions are welcome! This is an open-source project under the MIT license.
|
|
|
389
439
|
3. Open a PR against `master`
|
|
390
440
|
4. PRs require at least 1 review before merging
|
|
391
441
|
|
|
442
|
+
**Project stats:**
|
|
443
|
+
- **45+ Rust source files** — 16,000+ lines of native code
|
|
444
|
+
- **23 Python modules** — 5,000+ lines of API
|
|
445
|
+
- **47+ plot functions** (40 2D + 7 3D)
|
|
446
|
+
- **70+ colormaps** (35 base + 35 reversed)
|
|
447
|
+
- **262 tests** passing
|
|
448
|
+
- **12 formatters + 10 locators** (functional)
|
|
449
|
+
- **RGB/RGBA imshow**, bilinear interpolation, heatmap annotations
|
|
450
|
+
- **Signal processing**: specgram, psd, acorr, xcorr, coherence
|
|
451
|
+
- **Zero `unsafe` blocks**
|
|
452
|
+
|
|
392
453
|
**Priority areas for contribution:**
|
|
393
454
|
- Turning stub modules into full implementations (widgets, formatters/locators)
|
|
394
|
-
- Adding more colormaps with exact matplotlib data
|
|
395
455
|
- Improving SVG output fidelity
|
|
396
|
-
-
|
|
456
|
+
- Interactive 3D (mouse rotation)
|
|
457
|
+
- Qt/GTK backends
|
|
397
458
|
- More comprehensive test coverage
|
|
398
459
|
|
|
399
460
|
---
|
|
@@ -67,15 +67,16 @@ plt.show()
|
|
|
67
67
|
|
|
68
68
|
## What's Implemented
|
|
69
69
|
|
|
70
|
-
### 2D Plot Types (
|
|
70
|
+
### 2D Plot Types (40+ types)
|
|
71
71
|
| Function | Description |
|
|
72
72
|
|---|---|
|
|
73
|
-
| `plot()` | Line plots with color, linestyle, linewidth, markers, markevery, labels, alpha |
|
|
74
|
-
| `scatter()` | Scatter plots with per-point sizes, colors, markers, alpha |
|
|
75
|
-
| `bar()` / `barh()` | Vertical and horizontal bar charts (stacked
|
|
73
|
+
| `plot()` | Line plots with color, linestyle, linewidth, markers, markevery, labels, alpha, zorder |
|
|
74
|
+
| `scatter()` | Scatter plots with per-point sizes, colors, markers, alpha, zorder |
|
|
75
|
+
| `bar()` / `barh()` | Vertical and horizontal bar charts (stacked, hatch patterns, zorder) |
|
|
76
76
|
| `hist()` | Histograms with configurable bins |
|
|
77
|
-
| `imshow()` | Image/heatmap display with
|
|
77
|
+
| `imshow()` | Image/heatmap display with 70+ colormaps, bilinear interpolation, annotations |
|
|
78
78
|
| `fill_between()` / `fill_betweenx()` | Filled area between curves (vertical and horizontal) |
|
|
79
|
+
| `fill()` | Filled polygon from vertex arrays |
|
|
79
80
|
| `errorbar()` | Error bars with caps (xerr/yerr) |
|
|
80
81
|
| `step()` | Step plots (pre/post/mid) |
|
|
81
82
|
| `pie()` | Pie charts with labels |
|
|
@@ -86,8 +87,29 @@ plt.show()
|
|
|
86
87
|
| `hexbin()` | Hexagonal binning for 2D histograms |
|
|
87
88
|
| `quiver()` | Vector field arrows |
|
|
88
89
|
| `streamplot()` | Streamlines for vector fields (Euler integration) |
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
| `stackplot()` | Stacked area charts |
|
|
91
|
+
| `broken_barh()` | Broken horizontal bar charts |
|
|
92
|
+
| `eventplot()` | Event/raster plots |
|
|
93
|
+
| `pcolormesh()` / `pcolor()` | Pseudocolor plots for irregular grids |
|
|
94
|
+
| `matshow()` | Matrix display with integer ticks |
|
|
95
|
+
| `radar()` | Radar/spider charts |
|
|
96
|
+
| `sankey()` | Sankey flow diagrams |
|
|
97
|
+
| `spy()` | Sparsity pattern visualization |
|
|
98
|
+
| `stairs()` | Step-wise constant function with edges |
|
|
99
|
+
| `ecdf()` | Empirical cumulative distribution |
|
|
100
|
+
| `triplot()` | Triangulation edge drawing |
|
|
101
|
+
| `hist2d()` | 2D histogram heatmap |
|
|
102
|
+
| `specgram()` | Spectrogram (STFT-based) |
|
|
103
|
+
| `acorr()` / `xcorr()` | Auto/cross correlation |
|
|
104
|
+
| `psd()` | Power spectral density (Welch) |
|
|
105
|
+
| `magnitude_spectrum()` | FFT magnitude |
|
|
106
|
+
| `angle_spectrum()` / `phase_spectrum()` | FFT phase |
|
|
107
|
+
| `cohere()` / `csd()` | Coherence / cross spectral density |
|
|
108
|
+
| `semilogx()` / `semilogy()` / `loglog()` | Convenience log-scale plots |
|
|
109
|
+
| `arrow()` | Arrow drawing |
|
|
110
|
+
| `axline()` | Infinite line through point with slope |
|
|
111
|
+
|
|
112
|
+
### 3D Plot Types (7 types)
|
|
91
113
|
| Function | Description |
|
|
92
114
|
|---|---|
|
|
93
115
|
| `plot()` (3D) | 3D line plots |
|
|
@@ -95,6 +117,8 @@ plt.show()
|
|
|
95
117
|
| `plot_surface()` | 3D surface plots with colormaps |
|
|
96
118
|
| `plot_wireframe()` | 3D wireframe plots |
|
|
97
119
|
| `bar3d()` | 3D bar charts with shading |
|
|
120
|
+
| `plot_trisurf()` | 3D triangulated surface |
|
|
121
|
+
| `contour3D()` | 3D contour lines at Z offset |
|
|
98
122
|
|
|
99
123
|
### Layout & Figure
|
|
100
124
|
| Function | Description |
|
|
@@ -109,6 +133,9 @@ plt.show()
|
|
|
109
133
|
| `add_subplot(projection='3d')` | Add 3D subplot |
|
|
110
134
|
| `clf()` / `cla()` / `close()` | Clear and close figures |
|
|
111
135
|
| `gcf()` / `gca()` | Get current figure/axes |
|
|
136
|
+
| `subplot2grid()` | Subplot at specific grid position |
|
|
137
|
+
| `fig.add_gridspec()` | GridSpec from figure |
|
|
138
|
+
| `fig.legend()` | Figure-level legend |
|
|
112
139
|
|
|
113
140
|
### Axes Customization
|
|
114
141
|
| Function | Description |
|
|
@@ -125,7 +152,9 @@ plt.show()
|
|
|
125
152
|
| `axis('off')` | Hide axes completely |
|
|
126
153
|
| `set_facecolor()` | Axes background color |
|
|
127
154
|
| `spines['right'].set_visible(False)` | Spine customization |
|
|
128
|
-
| `twinx()` | Secondary y-axis |
|
|
155
|
+
| `twinx()` / `twiny()` | Secondary y-axis / x-axis |
|
|
156
|
+
| `zorder` | Drawing order control for all artists |
|
|
157
|
+
| `hatch` | Hatch patterns for bars (`/`, `\\`, `|`, `-`, `+`, `x`, `o`, `.`, `*`) |
|
|
129
158
|
| `legend()` | Legend with line+marker swatches and positioning |
|
|
130
159
|
| `grid()` | Grid lines with color, linewidth, linestyle, alpha, which |
|
|
131
160
|
| `text()` | Positioned text annotations |
|
|
@@ -135,6 +164,13 @@ plt.show()
|
|
|
135
164
|
| `axhspan()` / `axvspan()` | Shaded horizontal/vertical regions |
|
|
136
165
|
| `hlines()` / `vlines()` | Multiple reference lines with bounds |
|
|
137
166
|
| `colorbar()` | Color scale bar for imshow/contour |
|
|
167
|
+
| `get_xlim()` / `get_ylim()` | Get current axis limits (functional) |
|
|
168
|
+
| `clear()` | Clear all artists from axes |
|
|
169
|
+
| `ax.set(**kwargs)` | Set multiple properties at once |
|
|
170
|
+
| `minor=True` in set_xticks/yticks | Minor tick support |
|
|
171
|
+
| `bar_label()` | Value labels on bars |
|
|
172
|
+
| `set_xlabel(color=...)` | Label color customization |
|
|
173
|
+
| `title(loc='left')` | Title alignment |
|
|
138
174
|
|
|
139
175
|
### Output Formats
|
|
140
176
|
| Method | Description |
|
|
@@ -171,9 +207,13 @@ plt.show()
|
|
|
171
207
|
- **Format strings:** `"r--o"` = red + dashed + circle markers
|
|
172
208
|
- **markevery:** show marker every N points
|
|
173
209
|
|
|
174
|
-
### Colormaps (
|
|
210
|
+
### Colormaps (70+)
|
|
211
|
+
35 base colormaps + all reversed variants (`_r` suffix):
|
|
212
|
+
|
|
175
213
|
`viridis` `plasma` `inferno` `magma` `cividis` `twilight` `turbo` `hot` `cool` `gray` `jet` `spring` `summer` `autumn` `winter` `copper` `bone` `pink` `binary` `gist_heat` `ocean` `terrain` `Blues` `Reds` `Greens` `YlOrRd` `YlGnBu` `RdYlBu` `RdBu` `PiYG` `PRGn` `BrBG` `Spectral` `Set1` `Set2` `Set3` `Pastel1` `Pastel2` `tab20`
|
|
176
214
|
|
|
215
|
+
All also available as `viridis_r`, `plasma_r`, `hot_r`, etc.
|
|
216
|
+
|
|
177
217
|
### Text Rendering
|
|
178
218
|
- Embedded DejaVu Sans font (no system font dependency)
|
|
179
219
|
- LaTeX-to-Unicode conversion (`$\theta$` -> theta, `$x_1$` -> x1, Greek letters, sub/superscripts, math operators)
|
|
@@ -185,21 +225,31 @@ plt.show()
|
|
|
185
225
|
- **Dates:** `date2num()`, `num2date()`, date formatters and locators
|
|
186
226
|
- **Categorical axes:** string-based x values automatically converted
|
|
187
227
|
|
|
188
|
-
### Compatibility Modules
|
|
228
|
+
### Compatibility Modules (23 modules)
|
|
189
229
|
| Module | Status |
|
|
190
230
|
|---|---|
|
|
191
|
-
| `rustplotlib.pyplot` | Full implementation |
|
|
231
|
+
| `rustplotlib.pyplot` | Full implementation (50+ functions) |
|
|
192
232
|
| `rustplotlib.style` | Full implementation (6 themes) |
|
|
193
233
|
| `rustplotlib.animation` | FuncAnimation + GIF export |
|
|
194
234
|
| `rustplotlib.widgets` | Stubs (Slider, Button, CheckButtons, RadioButtons, TextBox, Cursor) |
|
|
195
|
-
| `rustplotlib.font_manager` | FontProperties
|
|
196
|
-
| `rustplotlib.ticker` | FormatStrFormatter
|
|
235
|
+
| `rustplotlib.font_manager` | FontProperties |
|
|
236
|
+
| `rustplotlib.ticker` | FormatStrFormatter |
|
|
197
237
|
| `rustplotlib.patches` | Rectangle, Circle, Polygon, FancyBboxPatch, Wedge |
|
|
198
238
|
| `rustplotlib.colors` | LinearSegmentedColormap, Normalize, LogNorm |
|
|
199
239
|
| `rustplotlib.dates` | Date conversion, formatters, locators |
|
|
200
240
|
| `rustplotlib.gridspec` | GridSpec, SubplotSpec |
|
|
201
|
-
| `rustplotlib.backends` | Backend system
|
|
241
|
+
| `rustplotlib.backends` | Backend system, PdfPages |
|
|
202
242
|
| `rustplotlib.mpl_toolkits.mplot3d` | Axes3D for 3D plotting |
|
|
243
|
+
| `rustplotlib.cm` | Colormap access by name |
|
|
244
|
+
| `rustplotlib.collections` | LineCollection, PathCollection, PatchCollection |
|
|
245
|
+
| `rustplotlib.lines` | Line2D with get/set methods |
|
|
246
|
+
| `rustplotlib.text` | Text, Annotation |
|
|
247
|
+
| `rustplotlib.transforms` | Bbox, Affine2D, BboxTransform |
|
|
248
|
+
| `rustplotlib.patheffects` | Stroke, withStroke, SimplePatchShadow |
|
|
249
|
+
| `rustplotlib.spines` | Spine |
|
|
250
|
+
| `rustplotlib.axes` | Axes class reference |
|
|
251
|
+
| `rustplotlib.figure` | Figure class reference |
|
|
252
|
+
| `rustplotlib.cycler` | cycler compatibility |
|
|
203
253
|
|
|
204
254
|
---
|
|
205
255
|
|
|
@@ -369,11 +419,22 @@ Contributions are welcome! This is an open-source project under the MIT license.
|
|
|
369
419
|
3. Open a PR against `master`
|
|
370
420
|
4. PRs require at least 1 review before merging
|
|
371
421
|
|
|
422
|
+
**Project stats:**
|
|
423
|
+
- **45+ Rust source files** — 16,000+ lines of native code
|
|
424
|
+
- **23 Python modules** — 5,000+ lines of API
|
|
425
|
+
- **47+ plot functions** (40 2D + 7 3D)
|
|
426
|
+
- **70+ colormaps** (35 base + 35 reversed)
|
|
427
|
+
- **262 tests** passing
|
|
428
|
+
- **12 formatters + 10 locators** (functional)
|
|
429
|
+
- **RGB/RGBA imshow**, bilinear interpolation, heatmap annotations
|
|
430
|
+
- **Signal processing**: specgram, psd, acorr, xcorr, coherence
|
|
431
|
+
- **Zero `unsafe` blocks**
|
|
432
|
+
|
|
372
433
|
**Priority areas for contribution:**
|
|
373
434
|
- Turning stub modules into full implementations (widgets, formatters/locators)
|
|
374
|
-
- Adding more colormaps with exact matplotlib data
|
|
375
435
|
- Improving SVG output fidelity
|
|
376
|
-
-
|
|
436
|
+
- Interactive 3D (mouse rotation)
|
|
437
|
+
- Qt/GTK backends
|
|
377
438
|
- More comprehensive test coverage
|
|
378
439
|
|
|
379
440
|
---
|