rustplotlib 3.0.0__tar.gz → 4.0.1__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.
Files changed (104) hide show
  1. rustplotlib-4.0.1/CLAUDE.md +112 -0
  2. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/Cargo.lock +1 -1
  3. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/Cargo.toml +1 -1
  4. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/PKG-INFO +51 -25
  5. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/README.md +50 -24
  6. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/ROADMAP.md +37 -55
  7. rustplotlib-4.0.1/benchmark_results.csv +13 -0
  8. rustplotlib-4.0.1/docs/superpowers/plans/2026-04-04-jupyter-and-event-foundation.md +920 -0
  9. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/pyproject.toml +1 -1
  10. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/pyplot.py +353 -5
  11. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/axes.rs +25 -1
  12. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/figure.rs +63 -27
  13. rustplotlib-4.0.1/tests/test_benchmark.py +309 -0
  14. rustplotlib-4.0.1/tests/test_jupyter_repr.py +15 -0
  15. rustplotlib-4.0.1/tests/test_spectral_features.py +441 -0
  16. rustplotlib-3.0.0/tests/test_benchmark.py +0 -123
  17. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/.github/workflows/ci.yml +0 -0
  18. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/.gitignore +0 -0
  19. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/CONTRIBUTING.md +0 -0
  20. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/LICENSE +0 -0
  21. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/dados/Data/PerfisTemp_rustplotlib.py +0 -0
  22. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/__init__.py +0 -0
  23. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/animation.py +0 -0
  24. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/axes/__init__.py +0 -0
  25. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/backends/__init__.py +0 -0
  26. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/backends/backend_inline.py +0 -0
  27. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/backends/backend_pdf.py +0 -0
  28. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/cm.py +0 -0
  29. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/collections.py +0 -0
  30. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/colors.py +0 -0
  31. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/cycler.py +0 -0
  32. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/dates.py +0 -0
  33. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/figure.py +0 -0
  34. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/font_manager.py +0 -0
  35. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/gridspec.py +0 -0
  36. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/lines.py +0 -0
  37. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/mpl_toolkits/__init__.py +0 -0
  38. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/mpl_toolkits/mplot3d/__init__.py +0 -0
  39. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/patches.py +0 -0
  40. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/patheffects.py +0 -0
  41. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/pyplot.pyi +0 -0
  42. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/spines.py +0 -0
  43. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/style/__init__.py +0 -0
  44. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/text.py +0 -0
  45. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/ticker.py +0 -0
  46. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/transforms.py +0 -0
  47. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/python/rustplotlib/widgets.py +0 -0
  48. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/arrow.rs +0 -0
  49. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/bar.rs +0 -0
  50. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/bar3d.rs +0 -0
  51. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/barh.rs +0 -0
  52. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/boxplot.rs +0 -0
  53. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/broken_barh.rs +0 -0
  54. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/contour.rs +0 -0
  55. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/contour3d.rs +0 -0
  56. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/errorbar.rs +0 -0
  57. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/eventplot.rs +0 -0
  58. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/fill_between.rs +0 -0
  59. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/fill_betweenx.rs +0 -0
  60. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/fill_polygon.rs +0 -0
  61. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/hexbin.rs +0 -0
  62. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/hist.rs +0 -0
  63. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/image.rs +0 -0
  64. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/legend.rs +0 -0
  65. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/line2d.rs +0 -0
  66. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/line3d.rs +0 -0
  67. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/mod.rs +0 -0
  68. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/patches.rs +0 -0
  69. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/pcolormesh.rs +0 -0
  70. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/pie.rs +0 -0
  71. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/quiver.rs +0 -0
  72. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/radar.rs +0 -0
  73. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/sankey.rs +0 -0
  74. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/scatter.rs +0 -0
  75. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/scatter3d.rs +0 -0
  76. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/stem.rs +0 -0
  77. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/step.rs +0 -0
  78. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/streamplot.rs +0 -0
  79. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/surface3d.rs +0 -0
  80. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/trisurf3d.rs +0 -0
  81. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/violin.rs +0 -0
  82. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/artists/wireframe3d.rs +0 -0
  83. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/axes3d.rs +0 -0
  84. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/colors.rs +0 -0
  85. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/fonts/DejaVuSans.ttf +0 -0
  86. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/lib.rs +0 -0
  87. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/projection3d.rs +0 -0
  88. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/svg_renderer.rs +0 -0
  89. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/text.rs +0 -0
  90. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/ticker.rs +0 -0
  91. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/transforms.rs +0 -0
  92. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/src/window.rs +0 -0
  93. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_3d.py +0 -0
  94. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_colors.py +0 -0
  95. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_figure.py +0 -0
  96. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_new_features.py +0 -0
  97. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_new_features2.py +0 -0
  98. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_phase6_7.py +0 -0
  99. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_phase8.py +0 -0
  100. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_phase9_features.py +0 -0
  101. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_pyplot.py +0 -0
  102. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_ticker.py +0 -0
  103. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_transforms.py +0 -0
  104. {rustplotlib-3.0.0 → rustplotlib-4.0.1}/tests/test_v3_features.py +0 -0
@@ -0,0 +1,112 @@
1
+ # RustPlotLib — Contexto para Agents
2
+
3
+ Reimplementação completa do matplotlib em Rust puro. Drop-in replacement via PyO3.
4
+
5
+ ## Linguagem
6
+
7
+ - Sempre responder em português (pt-BR)
8
+
9
+ ## Estado Atual — v4.0.0
10
+
11
+ - 40+ plot types 2D, 7 plot types 3D
12
+ - 70+ colormaps (35 base + 35 reversed)
13
+ - 21 módulos Python compatíveis com API matplotlib
14
+ - 267 testes passando
15
+ - Output: PNG (tiny-skia), SVG nativo, PDF, GIF, janela interativa
16
+ - Performance: até 30x mais rápido que matplotlib
17
+ - Zero blocos `unsafe` em todo o código Rust
18
+
19
+ ## Estrutura do Projeto
20
+
21
+ ```
22
+ src/ # Core Rust
23
+ ├── lib.rs # Registro de módulos PyO3
24
+ ├── figure.rs # Figure + bindings PyO3 (savefig, render)
25
+ ├── axes.rs # Axes 2D (~1500 linhas)
26
+ ├── axes3d.rs # Axes 3D
27
+ ├── projection3d.rs # Câmera + projeção 3D
28
+ ├── transforms.rs # Coordenadas de dados → pixels
29
+ ├── colors.rs # Parse de cores (named, hex, RGB, RGBA)
30
+ ├── text.rs # Renderização de texto (ab_glyph + DejaVu Sans)
31
+ ├── ticker.rs # Cálculo automático de ticks
32
+ ├── svg_renderer.rs # Output SVG nativo
33
+ ├── window.rs # Janela interativa (winit + softbuffer)
34
+ └── artists/ # Um arquivo por tipo de gráfico (35 arquivos)
35
+ ├── mod.rs # Trait Artist
36
+ ├── line2d.rs, scatter.rs, bar.rs, hist.rs, image.rs, ...
37
+ └── legend.rs
38
+
39
+ python/rustplotlib/ # Camada Python
40
+ ├── pyplot.py # API principal (drop-in matplotlib.pyplot)
41
+ ├── style/ # Temas (dark_background, ggplot, seaborn, bmh, fivethirtyeight)
42
+ ├── animation.py # FuncAnimation + GIF
43
+ ├── ticker.py # 12 Formatters + 10 Locators funcionais
44
+ ├── dates.py, colors.py, patches.py, ...
45
+ └── mpl_toolkits/mplot3d/ # Suporte 3D
46
+
47
+ tests/ # Testes Python (267 testes)
48
+ ```
49
+
50
+ ## Stack Técnica
51
+
52
+ | Componente | Tecnologia |
53
+ |---|---|
54
+ | Renderização 2D | tiny-skia |
55
+ | Fontes | ab_glyph + DejaVu Sans embutida |
56
+ | PNG | crate png |
57
+ | SVG | Renderer customizado |
58
+ | Janela | winit + softbuffer |
59
+ | 3D | Projeção ortográfica customizada |
60
+ | Bindings Python | PyO3 + maturin |
61
+ | NumPy interop | crate numpy (PyO3) |
62
+
63
+ ## Como Adicionar Features
64
+
65
+ ### Novo tipo de gráfico (caminho completo):
66
+ 1. `src/artists/novo_plot.rs` — implementar trait Artist (draw, data_bounds, legend_label, legend_color)
67
+ 2. `src/artists/mod.rs` — registrar módulo
68
+ 3. `src/axes.rs` — adicionar método no Axes
69
+ 4. `src/figure.rs` — adicionar binding PyO3
70
+ 5. `python/rustplotlib/pyplot.py` — wrapper Python (AxesProxy + função module-level)
71
+ 6. `tests/test_*.py` — testes
72
+ 7. `ROADMAP.md` — marcar checkbox `[x]`
73
+ 8. `README.md` — atualizar tabela de features
74
+
75
+ ### Feature simples (só Python):
76
+ Se pode ser construída em cima das funções Rust existentes, implementar direto em `pyplot.py`.
77
+
78
+ ## Comandos de Desenvolvimento
79
+
80
+ ```bash
81
+ cd /Users/thi4gon/Documents/workspace/matplot
82
+ source .venv/bin/activate
83
+ maturin develop # Build debug
84
+ maturin develop --release # Build release (benchmarks)
85
+ pytest tests/ -v # Rodar todos os testes
86
+ cargo check # Verificar compilação Rust
87
+ ```
88
+
89
+ ## Regras de Código
90
+
91
+ - **Zero `unsafe`** — sem exceção
92
+ - **Sem `.unwrap()` em input do usuário** — usar proper error handling
93
+ - **Validar inputs na fronteira PyO3** — path traversal, dimensões, tipos
94
+ - **Todo feature novo precisa de teste**
95
+ - **Manter compatibilidade com API do matplotlib** — mesmos nomes de funções e parâmetros
96
+ - **Atualizar ROADMAP.md e README.md** ao completar features
97
+
98
+ ## Roadmap Ativo (próximo: v5.0.0)
99
+
100
+ Próximos itens prioritários (ver ROADMAP.md para lista completa):
101
+
102
+ 1. **Jupyter inline backend** — rich display protocol, _repr_png_
103
+ 2. **Backends interativos** — Qt, GTK, macOS native
104
+ 3. **Widgets funcionais** — Slider, Button, CheckButtons com renderização real
105
+ 4. **Features interativas** — mouse events, zoom/pan, rotação 3D
106
+ 5. **Triangulation plots** — tricontour, tricontourf, tripcolor (atualmente stubs)
107
+
108
+ ## Git
109
+
110
+ - Branch principal: `master`
111
+ - Repo: `https://github.com/Thi4gon/rustplotlib`
112
+ - Commits seguem conventional commits: `feat:`, `fix:`, `docs:`, `release:`
@@ -1368,7 +1368,7 @@ dependencies = [
1368
1368
 
1369
1369
  [[package]]
1370
1370
  name = "rustplotlib"
1371
- version = "3.0.0"
1371
+ version = "4.0.1"
1372
1372
  dependencies = [
1373
1373
  "ab_glyph",
1374
1374
  "numpy",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rustplotlib"
3
- version = "3.0.0"
3
+ version = "4.0.1"
4
4
  edition = "2021"
5
5
  readme = "README.md"
6
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rustplotlib
3
- Version: 3.0.0
3
+ Version: 4.0.1
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Science/Research
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -37,7 +37,7 @@ No Python runtime dependency for rendering. No wrappers. No subprocess calls. Pu
37
37
  |---|---|---|---|
38
38
  | Rendering engine | C/C++ (AGG) | None (wrap matplotlib or call Python) | **Rust native (tiny-skia)** |
39
39
  | External dependencies | NumPy, Pillow, FreeType, etc. | Python + matplotlib required | **Zero** — self-contained |
40
- | Performance | Baseline | Same or slower (subprocess overhead) | **Up to 30x faster** |
40
+ | Performance | Baseline | Same or slower (subprocess overhead) | **Up to 16x faster** |
41
41
  | Python API | Original | Rust-only or generates .py scripts | **Drop-in replacement** — same API |
42
42
  | Approach | Interpreted + C extensions | Wrappers / code generators | **Full reimplementation in Rust** |
43
43
 
@@ -87,7 +87,7 @@ plt.show()
87
87
 
88
88
  ## What's Implemented
89
89
 
90
- ### 2D Plot Types (30+ types)
90
+ ### 2D Plot Types (40+ types)
91
91
  | Function | Description |
92
92
  |---|---|
93
93
  | `plot()` | Line plots with color, linestyle, linewidth, markers, markevery, labels, alpha, zorder |
@@ -118,7 +118,16 @@ plt.show()
118
118
  | `stairs()` | Step-wise constant function with edges |
119
119
  | `ecdf()` | Empirical cumulative distribution |
120
120
  | `triplot()` | Triangulation edge drawing |
121
- | `pcolormesh()` / `pcolor()` already listed above |
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 |
122
131
 
123
132
  ### 3D Plot Types (7 types)
124
133
  | Function | Description |
@@ -144,6 +153,9 @@ plt.show()
144
153
  | `add_subplot(projection='3d')` | Add 3D subplot |
145
154
  | `clf()` / `cla()` / `close()` | Clear and close figures |
146
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 |
147
159
 
148
160
  ### Axes Customization
149
161
  | Function | Description |
@@ -172,6 +184,13 @@ plt.show()
172
184
  | `axhspan()` / `axvspan()` | Shaded horizontal/vertical regions |
173
185
  | `hlines()` / `vlines()` | Multiple reference lines with bounds |
174
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 |
175
194
 
176
195
  ### Output Formats
177
196
  | Method | Description |
@@ -226,7 +245,7 @@ All also available as `viridis_r`, `plasma_r`, `hot_r`, etc.
226
245
  - **Dates:** `date2num()`, `num2date()`, date formatters and locators
227
246
  - **Categorical axes:** string-based x values automatically converted
228
247
 
229
- ### Compatibility Modules (23 modules)
248
+ ### Compatibility Modules (21 modules)
230
249
  | Module | Status |
231
250
  |---|---|
232
251
  | `rustplotlib.pyplot` | Full implementation (50+ functions) |
@@ -234,10 +253,10 @@ All also available as `viridis_r`, `plasma_r`, `hot_r`, etc.
234
253
  | `rustplotlib.animation` | FuncAnimation + GIF export |
235
254
  | `rustplotlib.widgets` | Stubs (Slider, Button, CheckButtons, RadioButtons, TextBox, Cursor) |
236
255
  | `rustplotlib.font_manager` | FontProperties |
237
- | `rustplotlib.ticker` | FormatStrFormatter |
238
- | `rustplotlib.patches` | Rectangle, Circle, Polygon, FancyBboxPatch, Wedge |
239
- | `rustplotlib.colors` | LinearSegmentedColormap, Normalize, LogNorm |
240
- | `rustplotlib.dates` | Date conversion, formatters, locators |
256
+ | `rustplotlib.ticker` | 12 Formatters + 10 Locators (functional) |
257
+ | `rustplotlib.patches` | Rectangle, Circle, Polygon, FancyBboxPatch, Wedge, FancyArrowPatch |
258
+ | `rustplotlib.colors` | LinearSegmentedColormap, Normalize, LogNorm, BoundaryNorm |
259
+ | `rustplotlib.dates` | Date conversion, DateFormatter, DateLocator, Auto/Day/Month/Year/Hour/MinuteLocator |
241
260
  | `rustplotlib.gridspec` | GridSpec, SubplotSpec |
242
261
  | `rustplotlib.backends` | Backend system, PdfPages |
243
262
  | `rustplotlib.mpl_toolkits.mplot3d` | Axes3D for 3D plotting |
@@ -248,7 +267,6 @@ All also available as `viridis_r`, `plasma_r`, `hot_r`, etc.
248
267
  | `rustplotlib.transforms` | Bbox, Affine2D, BboxTransform |
249
268
  | `rustplotlib.patheffects` | Stroke, withStroke, SimplePatchShadow |
250
269
  | `rustplotlib.spines` | Spine |
251
- | `rustplotlib.axes` | Axes class reference |
252
270
  | `rustplotlib.figure` | Figure class reference |
253
271
  | `rustplotlib.cycler` | cycler compatibility |
254
272
 
@@ -342,11 +360,18 @@ Benchmarked against matplotlib on Apple Silicon (M-series). Each test runs 10 it
342
360
 
343
361
  | Benchmark | matplotlib | rustplotlib | Speedup |
344
362
  |---|---|---|---|
345
- | Line Plot (10k points) | 0.064s | 0.002s | **30.8x** |
346
- | Scatter (5k points) | 0.029s | 0.017s | **1.7x** |
347
- | Bar Chart (50 bars) | 0.023s | 0.002s | **9.6x** |
348
- | Histogram (100k points) | 0.081s | 0.003s | **27.9x** |
349
- | Subplots 2x2 | 0.041s | 0.002s | **26.7x** |
363
+ | Line Plot (10k pts) | 0.028s | 0.005s | **5.3x** |
364
+ | Scatter (5k pts) | 0.028s | 0.021s | **1.4x** |
365
+ | Bar Chart (50 bars) | 0.026s | 0.005s | **5.0x** |
366
+ | Histogram (100k pts) | 0.090s | 0.006s | **16.1x** |
367
+ | Subplots 2x2 | 0.046s | 0.011s | **4.2x** |
368
+ | Heatmap (100x100) | 0.021s | 0.006s | **3.4x** |
369
+ | Large Line (100k pts) | 0.110s | 0.109s | **1.0x** |
370
+ | Multi-line (20 lines) | 0.090s | 0.037s | **2.4x** |
371
+ | Error Bars | 0.022s | 0.004s | **6.4x** |
372
+ | Pie Chart | 0.012s | 0.005s | **2.7x** |
373
+ | SVG Output | 0.021s | 0.003s | **6.9x** |
374
+ | Full Styled Plot | 0.019s | 0.006s | **3.4x** |
350
375
 
351
376
  Run the benchmark yourself:
352
377
  ```bash
@@ -421,21 +446,22 @@ Contributions are welcome! This is an open-source project under the MIT license.
421
446
  4. PRs require at least 1 review before merging
422
447
 
423
448
  **Project stats:**
424
- - **45+ Rust source files** — 15,000+ lines of native code
425
- - **23 Python modules** — 4,000+ lines of API
426
- - **37+ artist types** (30 2D + 7 3D)
449
+ - **45+ Rust source files** — 23,000+ lines of native code
450
+ - **21 Python modules** — 8,000+ lines of API
451
+ - **47+ plot functions** (40 2D + 7 3D)
427
452
  - **70+ colormaps** (35 base + 35 reversed)
428
- - **228 tests** passing
429
- - **12 formatters + 10 locators**
430
- - **RGB/RGBA imshow** support
453
+ - **267 tests** passing
454
+ - **22 formatters + locators** (functional)
455
+ - **RGB/RGBA imshow**, bilinear interpolation, heatmap annotations
456
+ - **Signal processing**: specgram, psd, acorr, xcorr, coherence
431
457
  - **Zero `unsafe` blocks**
432
458
 
433
459
  **Priority areas for contribution:**
434
- - Turning stub modules into full implementations (widgets, formatters/locators)
435
- - Improving SVG output fidelity
436
- - Interactive 3D (mouse rotation)
460
+ - Jupyter inline backend (rich display protocol)
461
+ - Functional widgets (Slider, Button, CheckButtons with real rendering)
462
+ - Interactive features (mouse events, zoom/pan, 3D rotation)
437
463
  - Qt/GTK backends
438
- - More comprehensive test coverage
464
+ - Triangulation plots (tricontour, tripcolor)
439
465
 
440
466
  ---
441
467
 
@@ -17,7 +17,7 @@ No Python runtime dependency for rendering. No wrappers. No subprocess calls. Pu
17
17
  |---|---|---|---|
18
18
  | Rendering engine | C/C++ (AGG) | None (wrap matplotlib or call Python) | **Rust native (tiny-skia)** |
19
19
  | External dependencies | NumPy, Pillow, FreeType, etc. | Python + matplotlib required | **Zero** — self-contained |
20
- | Performance | Baseline | Same or slower (subprocess overhead) | **Up to 30x faster** |
20
+ | Performance | Baseline | Same or slower (subprocess overhead) | **Up to 16x faster** |
21
21
  | Python API | Original | Rust-only or generates .py scripts | **Drop-in replacement** — same API |
22
22
  | Approach | Interpreted + C extensions | Wrappers / code generators | **Full reimplementation in Rust** |
23
23
 
@@ -67,7 +67,7 @@ plt.show()
67
67
 
68
68
  ## What's Implemented
69
69
 
70
- ### 2D Plot Types (30+ types)
70
+ ### 2D Plot Types (40+ types)
71
71
  | Function | Description |
72
72
  |---|---|
73
73
  | `plot()` | Line plots with color, linestyle, linewidth, markers, markevery, labels, alpha, zorder |
@@ -98,7 +98,16 @@ plt.show()
98
98
  | `stairs()` | Step-wise constant function with edges |
99
99
  | `ecdf()` | Empirical cumulative distribution |
100
100
  | `triplot()` | Triangulation edge drawing |
101
- | `pcolormesh()` / `pcolor()` already listed above |
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 |
102
111
 
103
112
  ### 3D Plot Types (7 types)
104
113
  | Function | Description |
@@ -124,6 +133,9 @@ plt.show()
124
133
  | `add_subplot(projection='3d')` | Add 3D subplot |
125
134
  | `clf()` / `cla()` / `close()` | Clear and close figures |
126
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 |
127
139
 
128
140
  ### Axes Customization
129
141
  | Function | Description |
@@ -152,6 +164,13 @@ plt.show()
152
164
  | `axhspan()` / `axvspan()` | Shaded horizontal/vertical regions |
153
165
  | `hlines()` / `vlines()` | Multiple reference lines with bounds |
154
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 |
155
174
 
156
175
  ### Output Formats
157
176
  | Method | Description |
@@ -206,7 +225,7 @@ All also available as `viridis_r`, `plasma_r`, `hot_r`, etc.
206
225
  - **Dates:** `date2num()`, `num2date()`, date formatters and locators
207
226
  - **Categorical axes:** string-based x values automatically converted
208
227
 
209
- ### Compatibility Modules (23 modules)
228
+ ### Compatibility Modules (21 modules)
210
229
  | Module | Status |
211
230
  |---|---|
212
231
  | `rustplotlib.pyplot` | Full implementation (50+ functions) |
@@ -214,10 +233,10 @@ All also available as `viridis_r`, `plasma_r`, `hot_r`, etc.
214
233
  | `rustplotlib.animation` | FuncAnimation + GIF export |
215
234
  | `rustplotlib.widgets` | Stubs (Slider, Button, CheckButtons, RadioButtons, TextBox, Cursor) |
216
235
  | `rustplotlib.font_manager` | FontProperties |
217
- | `rustplotlib.ticker` | FormatStrFormatter |
218
- | `rustplotlib.patches` | Rectangle, Circle, Polygon, FancyBboxPatch, Wedge |
219
- | `rustplotlib.colors` | LinearSegmentedColormap, Normalize, LogNorm |
220
- | `rustplotlib.dates` | Date conversion, formatters, locators |
236
+ | `rustplotlib.ticker` | 12 Formatters + 10 Locators (functional) |
237
+ | `rustplotlib.patches` | Rectangle, Circle, Polygon, FancyBboxPatch, Wedge, FancyArrowPatch |
238
+ | `rustplotlib.colors` | LinearSegmentedColormap, Normalize, LogNorm, BoundaryNorm |
239
+ | `rustplotlib.dates` | Date conversion, DateFormatter, DateLocator, Auto/Day/Month/Year/Hour/MinuteLocator |
221
240
  | `rustplotlib.gridspec` | GridSpec, SubplotSpec |
222
241
  | `rustplotlib.backends` | Backend system, PdfPages |
223
242
  | `rustplotlib.mpl_toolkits.mplot3d` | Axes3D for 3D plotting |
@@ -228,7 +247,6 @@ All also available as `viridis_r`, `plasma_r`, `hot_r`, etc.
228
247
  | `rustplotlib.transforms` | Bbox, Affine2D, BboxTransform |
229
248
  | `rustplotlib.patheffects` | Stroke, withStroke, SimplePatchShadow |
230
249
  | `rustplotlib.spines` | Spine |
231
- | `rustplotlib.axes` | Axes class reference |
232
250
  | `rustplotlib.figure` | Figure class reference |
233
251
  | `rustplotlib.cycler` | cycler compatibility |
234
252
 
@@ -322,11 +340,18 @@ Benchmarked against matplotlib on Apple Silicon (M-series). Each test runs 10 it
322
340
 
323
341
  | Benchmark | matplotlib | rustplotlib | Speedup |
324
342
  |---|---|---|---|
325
- | Line Plot (10k points) | 0.064s | 0.002s | **30.8x** |
326
- | Scatter (5k points) | 0.029s | 0.017s | **1.7x** |
327
- | Bar Chart (50 bars) | 0.023s | 0.002s | **9.6x** |
328
- | Histogram (100k points) | 0.081s | 0.003s | **27.9x** |
329
- | Subplots 2x2 | 0.041s | 0.002s | **26.7x** |
343
+ | Line Plot (10k pts) | 0.028s | 0.005s | **5.3x** |
344
+ | Scatter (5k pts) | 0.028s | 0.021s | **1.4x** |
345
+ | Bar Chart (50 bars) | 0.026s | 0.005s | **5.0x** |
346
+ | Histogram (100k pts) | 0.090s | 0.006s | **16.1x** |
347
+ | Subplots 2x2 | 0.046s | 0.011s | **4.2x** |
348
+ | Heatmap (100x100) | 0.021s | 0.006s | **3.4x** |
349
+ | Large Line (100k pts) | 0.110s | 0.109s | **1.0x** |
350
+ | Multi-line (20 lines) | 0.090s | 0.037s | **2.4x** |
351
+ | Error Bars | 0.022s | 0.004s | **6.4x** |
352
+ | Pie Chart | 0.012s | 0.005s | **2.7x** |
353
+ | SVG Output | 0.021s | 0.003s | **6.9x** |
354
+ | Full Styled Plot | 0.019s | 0.006s | **3.4x** |
330
355
 
331
356
  Run the benchmark yourself:
332
357
  ```bash
@@ -401,21 +426,22 @@ Contributions are welcome! This is an open-source project under the MIT license.
401
426
  4. PRs require at least 1 review before merging
402
427
 
403
428
  **Project stats:**
404
- - **45+ Rust source files** — 15,000+ lines of native code
405
- - **23 Python modules** — 4,000+ lines of API
406
- - **37+ artist types** (30 2D + 7 3D)
429
+ - **45+ Rust source files** — 23,000+ lines of native code
430
+ - **21 Python modules** — 8,000+ lines of API
431
+ - **47+ plot functions** (40 2D + 7 3D)
407
432
  - **70+ colormaps** (35 base + 35 reversed)
408
- - **228 tests** passing
409
- - **12 formatters + 10 locators**
410
- - **RGB/RGBA imshow** support
433
+ - **267 tests** passing
434
+ - **22 formatters + locators** (functional)
435
+ - **RGB/RGBA imshow**, bilinear interpolation, heatmap annotations
436
+ - **Signal processing**: specgram, psd, acorr, xcorr, coherence
411
437
  - **Zero `unsafe` blocks**
412
438
 
413
439
  **Priority areas for contribution:**
414
- - Turning stub modules into full implementations (widgets, formatters/locators)
415
- - Improving SVG output fidelity
416
- - Interactive 3D (mouse rotation)
440
+ - Jupyter inline backend (rich display protocol)
441
+ - Functional widgets (Slider, Button, CheckButtons with real rendering)
442
+ - Interactive features (mouse events, zoom/pan, 3D rotation)
417
443
  - Qt/GTK backends
418
- - More comprehensive test coverage
444
+ - Triangulation plots (tricontour, tripcolor)
419
445
 
420
446
  ---
421
447
 
@@ -4,90 +4,72 @@ Goal: Full matplotlib reimplementation in Rust.
4
4
 
5
5
  ---
6
6
 
7
- ## DONE — v2.0.0
7
+ ## DONE — v4.0.0
8
8
 
9
- ### 2D Plot Types (26 implemented)
10
- - [x] plot, scatter, bar, barh, hist, imshow, fill_between, fill_betweenx, fill
9
+ ### 2D Plot Types (40+ implemented)
10
+ - [x] plot, scatter, bar, barh, hist, imshow (RGB/RGBA + bilinear), fill_between, fill_betweenx, fill
11
11
  - [x] errorbar, step, pie, boxplot, violinplot, stem
12
12
  - [x] contour, contourf, hexbin, quiver, streamplot
13
13
  - [x] stackplot, broken_barh, eventplot, pcolormesh/pcolor, matshow, sankey
14
+ - [x] spy, stairs, ecdf, triplot, hist2d, arrow, axline
15
+ - [x] specgram, acorr, xcorr, psd, magnitude_spectrum, angle_spectrum, phase_spectrum
16
+ - [x] cohere, csd, semilogx, semilogy, loglog, radar
14
17
 
15
18
  ### 3D Plot Types (7 implemented)
16
19
  - [x] plot3D, scatter3D, plot_surface, plot_wireframe, bar3d, plot_trisurf, contour3D
17
20
 
18
- ### Drawing Elements (10 implemented)
19
- - [x] arrow, axhline, axvline, axhspan, axvspan, axline, hlines, vlines, annotate, text
21
+ ### Drawing Elements (12 implemented)
22
+ - [x] arrow, axhline, axvline, axhspan, axvspan, axline, hlines, vlines, annotate, text, table, colorbar
20
23
 
21
24
  ### Rendering
22
25
  - [x] PNG raster (tiny-skia), Native SVG (vector), PDF, Interactive window, GIF animation
26
+ - [x] bbox_inches='tight' (real whitespace cropping)
23
27
 
24
28
  ### Customization
25
29
  - [x] Log scale, twinx/twiny, spines, tick_params, zorder, hatch patterns
26
- - [x] Colorbar, 6 style themes, 70+ colormaps, custom fonts, rcParams (30+ keys)
27
- - [x] bbox_inches='tight', bilinear interpolation, title loc, multi-group plot
30
+ - [x] 6 style themes, 70+ colormaps (+ reversed), custom fonts, rcParams (30+ keys)
31
+ - [x] Bilinear interpolation, title loc, multi-group plot, image extent, RGB/RGBA imshow
28
32
  - [x] Aspect ratio, invert axes, axis off, subplot_mosaic, suptitle, subplots_adjust
33
+ - [x] Minor ticks rendering + `set_xticks(minor=True)` functional
34
+ - [x] Label colors, get_xlim/get_ylim (functional), axes clear
35
+ - [x] Image origin ('upper' / 'lower')
36
+
37
+ ### Formatters & Locators (22 implemented)
38
+ - [x] ScalarFormatter, LogFormatter, LogFormatterSciNotation, LogFormatterMathtext
39
+ - [x] EngFormatter, PercentFormatter, StrMethodFormatter, FuncFormatter, FormatStrFormatter
40
+ - [x] MaxNLocator, AutoLocator, MultipleLocator, LogLocator, FixedLocator, AutoMinorLocator
41
+ - [x] DateFormatter, AutoDateFormatter, DateLocator, AutoDateLocator
42
+ - [x] DayLocator, MonthLocator, YearLocator, HourLocator, MinuteLocator
29
43
 
30
44
  ### Compatibility Modules (23)
31
- - [x] pyplot, style, animation, widgets, font_manager, ticker, patches, colors
45
+ - [x] pyplot (50+ functions), style, animation, widgets, font_manager, ticker, patches, colors
32
46
  - [x] dates, gridspec, backends, mpl_toolkits.mplot3d, cm, collections, lines
33
47
  - [x] text, transforms, patheffects, spines, axes, figure, cycler
34
48
 
35
49
  ### Data Integration
36
- - [x] Pandas, NumPy, NaN handling, dates, categorical axes, imread/imsave
50
+ - [x] Pandas, NumPy, NaN handling, dates, categorical axes, imread/imsave, Jupyter inline
37
51
 
38
52
  ### Security
39
53
  - [x] Zero unsafe, path validation, dimension limits, no panics on user input
40
54
 
41
55
  ---
42
56
 
43
- ## IN PROGRESS v3.0.0
44
-
45
- ### Missing Plot Types
46
- - [ ] `spy()` — sparsity pattern visualization
47
- - [ ] `specgram()` — spectrogram
48
- - [ ] `acorr()` / `xcorr()` — auto/cross correlation
49
- - [ ] `angle_spectrum()` / `magnitude_spectrum()` / `phase_spectrum()`
50
- - [ ] `cohere()` — coherence plot
51
- - [ ] `csd()` / `psd()` — cross/power spectral density
52
- - [ ] `ecdf()` — empirical cumulative distribution
53
- - [ ] `stairs()` — step plot with edges
54
- - [ ] `tricontour()` / `tricontourf()` — contour on triangulation
55
- - [ ] `tripcolor()` — pseudocolor on triangulation
56
- - [ ] `triplot()` — plot triangulation edges
57
-
58
- ### Formatters & Locators (functional, not stubs)
59
- - [ ] `ScalarFormatter` — default number formatting
60
- - [ ] `LogFormatter` / `LogFormatterSciNotation`
61
- - [ ] `EngFormatter` — engineering notation (1k, 1M, 1G)
62
- - [ ] `PercentFormatter`
63
- - [ ] `StrMethodFormatter` / `FuncFormatter`
64
- - [ ] `MaxNLocator` — smart tick placement (partial, have auto_ticks)
65
- - [ ] `MultipleLocator` — ticks at multiples
66
- - [ ] `LogLocator` — logarithmic ticks
67
- - [ ] `FixedLocator` — user-specified positions
68
- - [ ] `AutoMinorLocator` — automatic minor ticks
69
- - [ ] `DateFormatter` functional (format ticks as dates)
70
- - [ ] `DateLocator` functional (place ticks at date intervals)
57
+ ## PLANNEDv5.0.0
58
+
59
+ ### Remaining Plot Types
60
+ - [ ] `tricontour()` / `tricontourf()` contour on triangulation (currently stubs)
61
+ - [ ] `tripcolor()` — pseudocolor on triangulation (currently stub)
71
62
 
72
63
  ### Advanced Customization
73
- - [ ] `FancyArrowPatch` — complex arrow styles (arc, angle, etc.)
74
- - [ ] `ConnectionPatch` — arrows connecting different axes
64
+ - [ ] `FancyArrowPatch` — complex arrow styles (arc, angle, etc.) — currently basic stub
65
+ - [ ] `ConnectionPatch` — arrows connecting different axes — currently basic stub
75
66
  - [ ] Spine positioning (`set_position('center')`, `set_position(('data', 0))`)
76
- - [ ] Minor ticks rendering (major/minor tick distinction)
77
67
  - [ ] Grid major/minor separate styling
78
- - [ ] `ax.set_xticks(minor=True)` functional
79
68
  - [ ] Colorbar as separate Axes (not inline drawing)
80
- - [ ] `TwoSlopeNorm`, `CenteredNorm`, `BoundaryNorm` functional
69
+ - [ ] `TwoSlopeNorm`, `CenteredNorm` functional
81
70
 
82
71
  ### Image Improvements
83
72
  - [ ] Bicubic, Lanczos, Spline interpolation
84
- - [ ] Image origin ('upper' vs 'lower')
85
- - [ ] Image extent parameter
86
- - [ ] RGB/RGBA image support in imshow
87
-
88
- ---
89
-
90
- ## PLANNED — v4.0.0
91
73
 
92
74
  ### Functional Backends
93
75
  - [ ] Qt backend (QApplication, mouse events, toolbar, save dialog)
@@ -116,7 +98,7 @@ Goal: Full matplotlib reimplementation in Rust.
116
98
 
117
99
  ---
118
100
 
119
- ## PLANNED — v5.0.0
101
+ ## PLANNED — v6.0.0
120
102
 
121
103
  ### Full LaTeX Math Rendering
122
104
  - [ ] TeX layout engine (fractions, roots, integrals, summation)
@@ -145,7 +127,7 @@ Goal: Full matplotlib reimplementation in Rust.
145
127
 
146
128
  ---
147
129
 
148
- ## PLANNED — v6.0.0
130
+ ## PLANNED — v7.0.0
149
131
 
150
132
  ### Geographic/Specialized Projections
151
133
  - [ ] Polar projection improvements (theta direction, offset)
@@ -183,7 +165,7 @@ Goal: Full matplotlib reimplementation in Rust.
183
165
  Pick any unchecked item, open an issue to discuss, submit a PR with tests.
184
166
 
185
167
  **Highest impact areas:**
186
- 1. Formatters/Locators (v3.0.0) — makes axes look professional
187
- 2. Jupyter backend (v4.0.0) — huge for data scientists
188
- 3. LaTeX rendering (v5.0.0) — needed for scientific papers
189
- 4. Interactive features (v4.0.0) — needed for exploratory analysis
168
+ 1. Jupyter backend (v5.0.0) — huge for data scientists
169
+ 2. Interactive features (v5.0.0) — needed for exploratory analysis
170
+ 3. LaTeX rendering (v6.0.0) — needed for scientific papers
171
+ 4. Triangulation plots (v5.0.0) — tricontour, tripcolor
@@ -0,0 +1,13 @@
1
+ benchmark,matplotlib_s,rustplotlib_s,speedup
2
+ Line Plot (10k pts),0.028050,0.005270,5.32
3
+ Scatter (5k pts),0.028230,0.020534,1.37
4
+ Bar Chart (50 bars),0.025549,0.005095,5.01
5
+ Histogram (100k pts),0.090139,0.005606,16.08
6
+ Subplots 2x2,0.046219,0.010970,4.21
7
+ Heatmap (100x100),0.020790,0.006080,3.42
8
+ Large Line (100k pts),0.109854,0.109353,1.00
9
+ Multi-line (20 lines),0.090231,0.037224,2.42
10
+ Error Bars,0.022393,0.003487,6.42
11
+ Pie Chart,0.012209,0.004486,2.72
12
+ SVG Output,0.020507,0.002972,6.90
13
+ Full Styled Plot,0.018751,0.005461,3.43