statanim 0.1.8__tar.gz → 0.2.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.
- statanim-0.2.0/PKG-INFO +335 -0
- statanim-0.2.0/README.md +290 -0
- {statanim-0.1.8 → statanim-0.2.0}/pyproject.toml +20 -5
- statanim-0.2.0/setup.py +14 -0
- statanim-0.2.0/statanim/__init__.py +43 -0
- statanim-0.2.0/statanim/__init__.pyi +432 -0
- statanim-0.2.0/statanim/_exports.py +429 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/animations/clt_demo.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/animations/flip_roll.py +36 -21
- {statanim-0.1.8 → statanim-0.2.0}/statanim/animations/sampling.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/animations/transitions.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/axes/axes3d.py +55 -36
- {statanim-0.1.8 → statanim-0.2.0}/statanim/axes/grid3d.py +32 -17
- {statanim-0.1.8 → statanim-0.2.0}/statanim/axes/number_plane3d.py +3 -2
- {statanim-0.1.8 → statanim-0.2.0}/statanim/charts/bar_chart3d.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/charts/box_plot3d.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/charts/heat_map3d.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/charts/histogram3d.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/charts/line_plot3d.py +24 -19
- {statanim-0.1.8 → statanim-0.2.0}/statanim/charts/scatter_plot3d.py +2 -1
- {statanim-0.1.8 → statanim-0.2.0}/statanim/charts/violin_plot3d.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/core/base.py +11 -4
- {statanim-0.1.8 → statanim-0.2.0}/statanim/core/colors.py +48 -34
- statanim-0.2.0/statanim/core/compat.py +37 -0
- statanim-0.2.0/statanim/core/flat.py +230 -0
- statanim-0.2.0/statanim/core/latex.py +256 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/core/math_utils.py +33 -18
- {statanim-0.1.8 → statanim-0.2.0}/statanim/core/tex_utils.py +61 -30
- {statanim-0.1.8 → statanim-0.2.0}/statanim/distributions/base_dist.py +45 -22
- {statanim-0.1.8 → statanim-0.2.0}/statanim/distributions/cdf_viz.py +29 -12
- {statanim-0.1.8 → statanim-0.2.0}/statanim/distributions/continuous_dists.py +3 -2
- {statanim-0.1.8 → statanim-0.2.0}/statanim/distributions/discrete_dists.py +11 -10
- {statanim-0.1.8 → statanim-0.2.0}/statanim/distributions/normal3d.py +3 -2
- {statanim-0.1.8 → statanim-0.2.0}/statanim/distributions/pdf_viz.py +10 -7
- {statanim-0.1.8 → statanim-0.2.0}/statanim/distributions/pmf_viz.py +1 -0
- statanim-0.2.0/statanim/inference/anova.py +215 -0
- statanim-0.2.0/statanim/inference/chi_square.py +207 -0
- statanim-0.2.0/statanim/inference/clt_plot.py +160 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/inference/confidence_interval.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/inference/error_types.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/inference/hypothesis.py +1 -0
- statanim-0.2.0/statanim/inference/hypothesis_plot.py +148 -0
- statanim-0.2.0/statanim/inference/mle.py +145 -0
- statanim-0.2.0/statanim/inference/roc_curve.py +125 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/inference/sampling_dist.py +2 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/probability/bayes.py +1 -0
- statanim-0.2.0/statanim/probability/bayes_update.py +135 -0
- statanim-0.2.0/statanim/probability/monty_hall.py +105 -0
- statanim-0.2.0/statanim/probability/natural_frequency.py +137 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/probability/prob_tree.py +2 -1
- {statanim-0.1.8 → statanim-0.2.0}/statanim/probability/sample_space.py +2 -1
- {statanim-0.1.8 → statanim-0.2.0}/statanim/probability/venn3d.py +2 -1
- {statanim-0.1.8 → statanim-0.2.0}/statanim/props/card.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/props/coin.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/props/die.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/props/spinner.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/props/urn.py +1 -0
- statanim-0.2.0/statanim/quick.py +417 -0
- statanim-0.2.0/statanim/regression/bias_variance.py +124 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/regression/correlation.py +4 -3
- statanim-0.2.0/statanim/regression/pca.py +96 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/regression/regression_plane.py +32 -17
- {statanim-0.1.8 → statanim-0.2.0}/statanim/regression/residuals.py +23 -8
- statanim-0.2.0/statanim/regression/simpson.py +114 -0
- statanim-0.2.0/statanim/regression/time_series.py +178 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/scenes/demo_bayes.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/scenes/demo_clt.py +20 -5
- {statanim-0.1.8 → statanim-0.2.0}/statanim/scenes/demo_distributions.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/scenes/demo_hypothesis.py +20 -5
- statanim-0.2.0/statanim/ui/__init__.py +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/ui/labels.py +59 -44
- {statanim-0.1.8 → statanim-0.2.0}/statanim/ui/panels.py +2 -1
- {statanim-0.1.8 → statanim-0.2.0}/statanim/ui/table3d.py +1 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/ui/ticker.py +8 -5
- statanim-0.2.0/statanim.egg-info/PKG-INFO +335 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim.egg-info/SOURCES.txt +32 -1
- {statanim-0.1.8 → statanim-0.2.0}/statanim.egg-info/requires.txt +6 -0
- statanim-0.2.0/tests/test_api_conventions.py +70 -0
- statanim-0.2.0/tests/test_classes.py +55 -0
- statanim-0.2.0/tests/test_imports.py +69 -0
- statanim-0.2.0/tests/test_latex_fallback.py +59 -0
- statanim-0.2.0/tests/test_math_utils.py +176 -0
- statanim-0.2.0/tests/test_naming.py +70 -0
- statanim-0.2.0/tests/test_render.py +73 -0
- statanim-0.2.0/tests/test_skill.py +70 -0
- statanim-0.2.0/tests/test_topics.py +210 -0
- statanim-0.2.0/tests/test_topics2.py +299 -0
- statanim-0.1.8/PKG-INFO +0 -247
- statanim-0.1.8/README.md +0 -211
- statanim-0.1.8/statanim/__init__.py +0 -3
- statanim-0.1.8/statanim.egg-info/PKG-INFO +0 -247
- {statanim-0.1.8 → statanim-0.2.0}/LICENSE +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/setup.cfg +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/animations/__init__.py +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/axes/__init__.py +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/charts/__init__.py +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/core/__init__.py +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/distributions/__init__.py +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/inference/__init__.py +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/probability/__init__.py +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim/props/__init__.py +0 -0
- /statanim-0.1.8/statanim/regression/__init__.py → /statanim-0.2.0/statanim/py.typed +0 -0
- {statanim-0.1.8/statanim/scenes → statanim-0.2.0/statanim/regression}/__init__.py +0 -0
- {statanim-0.1.8/statanim/ui → statanim-0.2.0/statanim/scenes}/__init__.py +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim.egg-info/dependency_links.txt +0 -0
- {statanim-0.1.8 → statanim-0.2.0}/statanim.egg-info/top_level.txt +0 -0
statanim-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: statanim
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A Manim extension for animated statistical visualisations — distributions, regression, probability, inference and more.
|
|
5
|
+
Home-page: https://github.com/rishabhbhartiya/statanim
|
|
6
|
+
Author: Rishabh Bhartiya
|
|
7
|
+
Author-email: Rishabh Bhartiya <rishabh.bhartiya.in@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/rishabhbhartiya/statanim
|
|
10
|
+
Project-URL: Documentation, https://statanim.readthedocs.io
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/rishabhbhartiya/statanim/issues
|
|
12
|
+
Project-URL: Source Code, https://github.com/rishabhbhartiya/statanim
|
|
13
|
+
Keywords: manim,statistics,animation,data-science,probability,regression,distribution,education,visualisation,math
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Education
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
19
|
+
Classifier: Topic :: Education
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: manim>=0.18.0
|
|
29
|
+
Requires-Dist: numpy>=1.24
|
|
30
|
+
Requires-Dist: scipy>=1.10
|
|
31
|
+
Requires-Dist: colour
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: build; extra == "dev"
|
|
34
|
+
Requires-Dist: twine; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff; extra == "dev"
|
|
38
|
+
Provides-Extra: docs
|
|
39
|
+
Requires-Dist: sphinx>=7.0; extra == "docs"
|
|
40
|
+
Requires-Dist: sphinx_rtd_theme>=2.0; extra == "docs"
|
|
41
|
+
Requires-Dist: sphinxcontrib-mermaid>=0.9; extra == "docs"
|
|
42
|
+
Dynamic: author
|
|
43
|
+
Dynamic: home-page
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
<div align="center">
|
|
47
|
+
<img src="https://raw.githubusercontent.com/rishabhbhartiya/STATANIM/main/banner.svg" alt="STATANIM — Statistical Animation for Manim" width="680"/>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div align="center">
|
|
51
|
+
|
|
52
|
+
[](https://pypi.org/project/statanim/)
|
|
53
|
+
[](https://pepy.tech/projects/statanim)
|
|
54
|
+
[](https://statanim.readthedocs.io/en/latest/)
|
|
55
|
+
[](https://www.python.org/downloads/)
|
|
56
|
+
[](https://www.manim.community/)
|
|
57
|
+
[](./LICENSE)
|
|
58
|
+
|
|
59
|
+
**Animated statistics for [Manim](https://www.manim.community/).**
|
|
60
|
+
One line of Python turns your data into an explainer video: ANOVA, chi-square, t-tests, Bayes' theorem, CLT, PCA, ROC and more.
|
|
61
|
+
|
|
62
|
+
  
|
|
63
|
+
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Why statanim?
|
|
69
|
+
|
|
70
|
+
Manim is extraordinary at animating mathematics, but statistics is another story: a shaded normal tail, a probability tree that builds itself, or the moment an ANOVA's between-group spread is compared with its within-group spread each take hundreds of lines of low-level geometry before you even reach the idea you want to teach.
|
|
71
|
+
|
|
72
|
+
statanim gives statistics the same treatment Manim gives maths: objects that *understand* what they represent, animations that carry statistical meaning, and numbers computed by the library itself (so the video and the statistic always agree).
|
|
73
|
+
|
|
74
|
+
- **One-liner videos**: `quick.anova(...)`, `quick.chi_square(...)`, `quick.bayes_theorem(...)` return a ready-to-render video.
|
|
75
|
+
- **Staged objects** for your own scenes: every piece of a figure (points, means, the p-value...) is revealed by a `show_*` step you place in your story.
|
|
76
|
+
- **No LaTeX needed**: formulas fall back to plain Unicode text; install LaTeX only if you want typeset maths.
|
|
77
|
+
- **Your data or a built-in example**: lists, NumPy arrays, CSV columns.
|
|
78
|
+
- **An [Agent Skill](#claude-skill)** so Claude can make these videos for you.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Installation
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install statanim
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
statanim installs Manim for you. Manim itself needs FFmpeg and the Cairo/Pango libraries
|
|
89
|
+
(see the [Manim install guide](https://docs.manim.community/en/stable/installation.html)). Requires Python 3.10+.
|
|
90
|
+
The one-liners and the 13 newer topics need statanim 0.2.0 or later.
|
|
91
|
+
|
|
92
|
+
<details>
|
|
93
|
+
<summary><b>LaTeX (optional)</b>, <b>Docker</b>, <b>Colab</b>, <b>from source</b></summary>
|
|
94
|
+
|
|
95
|
+
**LaTeX is optional.** With it, formulas render as typeset maths. Without it, statanim falls back to Unicode text
|
|
96
|
+
(`σ²`, `μ₀`, `(a+b)/2`) and every scene still renders.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
brew install mactex-no-gui # macOS
|
|
100
|
+
sudo apt-get install texlive-latex-base texlive-latex-extra texlive-fonts-recommended texlive-science dvisvgm # Debian/Ubuntu
|
|
101
|
+
# Windows: install MiKTeX from https://miktex.org/
|
|
102
|
+
|
|
103
|
+
STATANIM_NO_LATEX=1 manim -ql scene.py MyScene # force the Unicode fallback
|
|
104
|
+
STATANIM_NO_LATEX=0 manim -ql scene.py MyScene # force LaTeX
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
In code: `from statanim.core.latex import set_latex_enabled; set_latex_enabled(False)`.
|
|
108
|
+
|
|
109
|
+
**Docker**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
docker build -t statanim . # small image, no LaTeX
|
|
113
|
+
docker build -t statanim --build-arg WITH_LATEX=1 . # with LaTeX
|
|
114
|
+
docker run --rm -v "$PWD":/workspace statanim -ql examples/card_probability_scene.py SampleSpaceScene
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Colab**: [open the quickstart notebook](https://colab.research.google.com/github/rishabhbhartiya/STATANIM/blob/main/notebooks/statanim_quickstart.ipynb).
|
|
118
|
+
|
|
119
|
+
**From source**
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
git clone https://github.com/rishabhbhartiya/STATANIM.git
|
|
123
|
+
cd STATANIM
|
|
124
|
+
pip install -e ".[dev]"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
</details>
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Quick start
|
|
132
|
+
|
|
133
|
+
### 1. A video in one line
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
from statanim import quick
|
|
137
|
+
|
|
138
|
+
video = quick.anova([5.1, 4.8, 5.6, 5.0], [6.0, 6.4, 5.8, 6.9], [7.9, 8.4, 7.5, 8.8],
|
|
139
|
+
labels=["Control", "Drug A", "Drug B"], title="Do the three groups differ?")
|
|
140
|
+
video.render("medium") # writes an .mp4 and returns its path
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Every call checks its input (counts must be non-negative, ROC labels must contain both classes, ...) and raises a
|
|
144
|
+
clear `ValueError` before rendering. `render()` takes `quality="low|medium|high|4k"`, `output=`, `last_frame=True`
|
|
145
|
+
(a fast PNG preview) and `media_dir=`; `video.scene_class` is a normal Manim scene you can extend or render with the
|
|
146
|
+
`manim` command. Default file names encode the topic and a hash of the data, so videos never overwrite each other.
|
|
147
|
+
|
|
148
|
+
### 2. Your own scene
|
|
149
|
+
|
|
150
|
+
Each topic class puts all its layers in the group from the start, hidden; a `show_*` method returns the animation that
|
|
151
|
+
reveals one layer. You decide the order, the pauses and the captions.
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
import numpy as np
|
|
155
|
+
from manim import *
|
|
156
|
+
from statanim import ANOVA3D
|
|
157
|
+
|
|
158
|
+
class Compare(Scene):
|
|
159
|
+
def construct(self):
|
|
160
|
+
rng = np.random.default_rng(1)
|
|
161
|
+
groups = [rng.normal(m, 1.0, 12) for m in (5, 6.2, 8.0)]
|
|
162
|
+
anova = ANOVA3D(groups, labels=["Control", "Drug A", "Drug B"], y_label="response")
|
|
163
|
+
self.add(anova)
|
|
164
|
+
for step in (anova.show_points, anova.show_group_means, anova.show_grand_mean,
|
|
165
|
+
anova.show_between, anova.show_within, anova.show_result, anova.show_posthoc):
|
|
166
|
+
self.play(step())
|
|
167
|
+
self.wait(0.5)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
manim -ql scene.py Compare
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The newer classes are flat, work in `Scene` and `ThreeDScene`, and stay aligned when you `shift`, `scale` or `move_to` them.
|
|
175
|
+
|
|
176
|
+
### 3. The classic 3-D objects
|
|
177
|
+
|
|
178
|
+
The original statanim objects (`NormalCurve3D`, charts, regression planes, cards, dice, ...) live in 3-D space and need a
|
|
179
|
+
`ThreeDScene` with a camera orientation, otherwise they collapse into a flat line.
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
from manim import *
|
|
183
|
+
from statanim import NormalCurve3D
|
|
184
|
+
|
|
185
|
+
class NormalDemo(ThreeDScene):
|
|
186
|
+
def construct(self):
|
|
187
|
+
self.set_camera_orientation(phi=70 * DEGREES, theta=-45 * DEGREES)
|
|
188
|
+
curve = NormalCurve3D(mu=0, sigma=1)
|
|
189
|
+
self.play(Create(curve))
|
|
190
|
+
self.play(FadeIn(curve.shade_region(x_min=-1, x_max=1, scene=self)))
|
|
191
|
+
self.wait(2)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
from manim import *
|
|
196
|
+
from statanim import Deck3D, CardFacing, standard_deck
|
|
197
|
+
|
|
198
|
+
class CardDraw(Scene):
|
|
199
|
+
def construct(self):
|
|
200
|
+
deck = Deck3D(cards=standard_deck(shuffle=True, seed=0), initial_facing=CardFacing.FACE_DOWN)
|
|
201
|
+
deck.move_to(LEFT * 3)
|
|
202
|
+
self.play(FadeIn(deck))
|
|
203
|
+
self.play(deck.deal_one(target=RIGHT * 2, flip=True))
|
|
204
|
+
self.wait(2)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## What you can make
|
|
210
|
+
|
|
211
|
+
| Topic | One-liner | Class (own scenes) |
|
|
212
|
+
|---|---|---|
|
|
213
|
+
| Bayesian updating (Beta prior to posterior) | `quick.bayes_update` | `BetaBinomialUpdate3D` |
|
|
214
|
+
| Bayes' theorem with natural frequencies | `quick.bayes_theorem` | `NaturalFrequencyGrid` |
|
|
215
|
+
| One-way ANOVA + Tukey HSD | `quick.anova` | `ANOVA3D` |
|
|
216
|
+
| Chi-square: goodness of fit and independence | `quick.chi_square` | `ChiSquareTest3D` |
|
|
217
|
+
| One-sample z / t test | `quick.hypothesis_test` | `HypothesisTestPlot` |
|
|
218
|
+
| Central Limit Theorem | `quick.clt` | `CLTPlot` |
|
|
219
|
+
| Maximum likelihood estimation | `quick.mle` | `MLE3D` |
|
|
220
|
+
| PCA in 2-D | `quick.pca` | `PCAProjection` |
|
|
221
|
+
| ROC curve and AUC | `quick.roc` | `ROCCurve` |
|
|
222
|
+
| Bias-variance trade-off | `quick.bias_variance` | `BiasVarianceTradeoff` |
|
|
223
|
+
| Simpson's paradox | `quick.simpson` | `SimpsonParadox3D` |
|
|
224
|
+
| Monty Hall | `quick.monty_hall` | `MontyHallSimulation` |
|
|
225
|
+
| ACF / PACF and an AR / ARI forecast | `quick.time_series` | `TimeSeriesDiagnostics` |
|
|
226
|
+
| Normal curve with a shaded probability | `quick.normal` | `NormalCurve3D` |
|
|
227
|
+
|
|
228
|
+
What each video shows, its inputs and the assumptions it does not check are listed in
|
|
229
|
+
[`skills/statanim/references/topics.md`](skills/statanim/references/topics.md); exact signatures are in the
|
|
230
|
+
[API docs](https://statanim.readthedocs.io/en/latest/api/index.html).
|
|
231
|
+
|
|
232
|
+
<details>
|
|
233
|
+
<summary><b>Gallery</b> (14 videos)</summary>
|
|
234
|
+
|
|
235
|
+
| | | |
|
|
236
|
+
|:--:|:--:|:--:|
|
|
237
|
+
| <br>Bayesian updating | <br>ANOVA + Tukey HSD | <br>Chi-square goodness of fit |
|
|
238
|
+
| <br>Chi-square independence | <br>Maximum likelihood | <br>Simpson's paradox |
|
|
239
|
+
| <br>t test | <br>Central Limit Theorem | <br>Bayes, natural frequencies |
|
|
240
|
+
| <br>PCA | <br>Bias–variance | <br>ROC / AUC |
|
|
241
|
+
| <br>Monty Hall | <br>ACF / PACF / forecast | |
|
|
242
|
+
|
|
243
|
+
Regenerate with `python scripts/make_gifs.py`. Scene code: [`examples/topics_quickstart.py`](examples/topics_quickstart.py), [`examples/topics_more.py`](examples/topics_more.py).
|
|
244
|
+
|
|
245
|
+
**Original demos**
|
|
246
|
+
|
|
247
|
+

|
|
248
|
+

|
|
249
|
+

|
|
250
|
+

|
|
251
|
+

|
|
252
|
+
|
|
253
|
+
</details>
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## What's inside
|
|
258
|
+
|
|
259
|
+
| Module | What it gives you |
|
|
260
|
+
|---|---|
|
|
261
|
+
| `distributions` | Normal, Binomial, Poisson, Hypergeometric, Beta, Gamma, Chi-squared, Student-t, F, each with PDF/PMF/CDF visualisers and shadeable regions |
|
|
262
|
+
| `charts` | `BarChart3D`, `Histogram3D`, `BoxPlot3D`, `ViolinPlot3D`, `HeatMap3D`, `ScatterPlot3D`, `LineSeries3D`, `MultiLinePlot3D` |
|
|
263
|
+
| `probability` | `SampleSpace3D`, `VennDiagram3D`, `ProbabilityTree3D`, `BayesBox3D`, plus `BetaBinomialUpdate3D`, `NaturalFrequencyGrid`, `MontyHallSimulation` |
|
|
264
|
+
| `inference` | `HypothesisTest3D`, `ConfidenceInterval3D`, `SamplingDistribution3D`, plus `ANOVA3D`, `ChiSquareTest3D`, `HypothesisTestPlot`, `CLTPlot`, `MLE3D`, `ROCCurve` |
|
|
265
|
+
| `regression` | `RegressionPlane3D`, `ScatterCloud3D`, residual diagnostics, correlation matrices, plus `PCAProjection`, `BiasVarianceTradeoff`, `SimpsonParadox3D`, `TimeSeriesDiagnostics` |
|
|
266
|
+
| `props` | `Card3D`, `Deck3D`, `Coin3D`, `Die3D` (D4, D6, D8, D12, D20), `Spinner3D`, `Urn3D`: physical probability objects with built-in logic |
|
|
267
|
+
| `animations` | `CLTDemo`, `DistMorph3D`, `ParameterSweep3D`, `BootstrapSampling3D`, `ScatterToRegression3D` |
|
|
268
|
+
| `ui` | `Ticker3D`, `PValueTicker3D`, `FormulaPanel3D`, `DataTable3D`, `AnnotationArrow3D` |
|
|
269
|
+
| `core` | Themes (`DARK_THEME`, `LIGHT_THEME`, `PAPER_THEME`, ...), `FlatAxes`, the statistics engine in `math_utils` (tests, OLS, correlations), the LaTeX fallback |
|
|
270
|
+
| `quick` | The one-liner videos |
|
|
271
|
+
|
|
272
|
+
Every public class is importable from the top level (`from statanim import ANOVA3D`); the deep paths
|
|
273
|
+
(`statanim.inference.anova`) keep working. Naming rules and the list of renamed classes and keywords are in
|
|
274
|
+
[API conventions](https://statanim.readthedocs.io/en/latest/api_conventions.html).
|
|
275
|
+
|
|
276
|
+
**Camera orientations for the 3-D objects** (`self.set_camera_orientation(phi=..., theta=...)`)
|
|
277
|
+
|
|
278
|
+
| Scene | phi | theta |
|
|
279
|
+
|---|---|---|
|
|
280
|
+
| 3D bar chart | 65° | -55° |
|
|
281
|
+
| Regression plane | 70° | -45° |
|
|
282
|
+
| Scatter cloud | 70° | -60° |
|
|
283
|
+
| Card grid (table-top) | 60° | -45° |
|
|
284
|
+
| Bivariate normal surface | 68° | -45° |
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Claude skill
|
|
289
|
+
|
|
290
|
+
`skills/statanim/` is an [Agent Skill](https://agentskills.io): it lets Claude (and other agents that support the format)
|
|
291
|
+
turn a request such as "animate whether these three groups differ" into a rendered statistics video. It checks the numbers
|
|
292
|
+
independently, previews the final frame, and reports the statistics and the assumptions behind them.
|
|
293
|
+
|
|
294
|
+
- **claude.ai**: download `statanim.skill` from the [latest release](https://github.com/rishabhbhartiya/STATANIM/releases/latest),
|
|
295
|
+
then Customize → Skills → upload.
|
|
296
|
+
- **Claude Code**: copy `skills/statanim/` to `~/.claude/skills/statanim/`.
|
|
297
|
+
|
|
298
|
+
The skill installs statanim and Manim on first use, so its sandbox needs access to PyPI. Details: [`docs/RELEASING.md`](docs/RELEASING.md).
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Documentation
|
|
303
|
+
|
|
304
|
+
- Docs: <https://statanim.readthedocs.io/en/latest/> (getting started, example gallery, API reference, API conventions)
|
|
305
|
+
- [`docs/reference/API_REFERENCE.md`](docs/reference/API_REFERENCE.md): full class and parameter reference for the classic objects
|
|
306
|
+
- [`CHANGELOG.md`](CHANGELOG.md), [`CONTRIBUTING.md`](CONTRIBUTING.md), [`docs/RELEASING.md`](docs/RELEASING.md)
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Contributing
|
|
311
|
+
|
|
312
|
+
Issues and pull requests are welcome at [github.com/rishabhbhartiya/STATANIM](https://github.com/rishabhbhartiya/STATANIM).
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
git clone https://github.com/rishabhbhartiya/STATANIM.git && cd STATANIM
|
|
316
|
+
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
317
|
+
pip install -e ".[dev]"
|
|
318
|
+
pytest # add --run-render for real renders
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
New topic classes should build on `statanim.core.flat.StagedGroup` / `FlatAxes` and use the naming rules in
|
|
322
|
+
[CONTRIBUTING.md](CONTRIBUTING.md). After adding public classes run `python scripts/gen_exports.py`.
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Acknowledgements
|
|
327
|
+
|
|
328
|
+
Built on [Manim Community](https://www.manim.community/). Statistical algorithms from [SciPy](https://scipy.org/) and
|
|
329
|
+
[NumPy](https://numpy.org/). Inspired by the mathematical animation work of 3Blue1Brown.
|
|
330
|
+
|
|
331
|
+
## License
|
|
332
|
+
|
|
333
|
+
MIT License. See [LICENSE](./LICENSE).
|
|
334
|
+
|
|
335
|
+
**Author:** Rishabh Bhartiya — [rishabh.bhartiya.in@gmail.com](mailto:rishabh.bhartiya.in@gmail.com)
|
statanim-0.2.0/README.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/rishabhbhartiya/STATANIM/main/banner.svg" alt="STATANIM — Statistical Animation for Manim" width="680"/>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
<div align="center">
|
|
6
|
+
|
|
7
|
+
[](https://pypi.org/project/statanim/)
|
|
8
|
+
[](https://pepy.tech/projects/statanim)
|
|
9
|
+
[](https://statanim.readthedocs.io/en/latest/)
|
|
10
|
+
[](https://www.python.org/downloads/)
|
|
11
|
+
[](https://www.manim.community/)
|
|
12
|
+
[](./LICENSE)
|
|
13
|
+
|
|
14
|
+
**Animated statistics for [Manim](https://www.manim.community/).**
|
|
15
|
+
One line of Python turns your data into an explainer video: ANOVA, chi-square, t-tests, Bayes' theorem, CLT, PCA, ROC and more.
|
|
16
|
+
|
|
17
|
+
  
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Why statanim?
|
|
24
|
+
|
|
25
|
+
Manim is extraordinary at animating mathematics, but statistics is another story: a shaded normal tail, a probability tree that builds itself, or the moment an ANOVA's between-group spread is compared with its within-group spread each take hundreds of lines of low-level geometry before you even reach the idea you want to teach.
|
|
26
|
+
|
|
27
|
+
statanim gives statistics the same treatment Manim gives maths: objects that *understand* what they represent, animations that carry statistical meaning, and numbers computed by the library itself (so the video and the statistic always agree).
|
|
28
|
+
|
|
29
|
+
- **One-liner videos**: `quick.anova(...)`, `quick.chi_square(...)`, `quick.bayes_theorem(...)` return a ready-to-render video.
|
|
30
|
+
- **Staged objects** for your own scenes: every piece of a figure (points, means, the p-value...) is revealed by a `show_*` step you place in your story.
|
|
31
|
+
- **No LaTeX needed**: formulas fall back to plain Unicode text; install LaTeX only if you want typeset maths.
|
|
32
|
+
- **Your data or a built-in example**: lists, NumPy arrays, CSV columns.
|
|
33
|
+
- **An [Agent Skill](#claude-skill)** so Claude can make these videos for you.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install statanim
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
statanim installs Manim for you. Manim itself needs FFmpeg and the Cairo/Pango libraries
|
|
44
|
+
(see the [Manim install guide](https://docs.manim.community/en/stable/installation.html)). Requires Python 3.10+.
|
|
45
|
+
The one-liners and the 13 newer topics need statanim 0.2.0 or later.
|
|
46
|
+
|
|
47
|
+
<details>
|
|
48
|
+
<summary><b>LaTeX (optional)</b>, <b>Docker</b>, <b>Colab</b>, <b>from source</b></summary>
|
|
49
|
+
|
|
50
|
+
**LaTeX is optional.** With it, formulas render as typeset maths. Without it, statanim falls back to Unicode text
|
|
51
|
+
(`σ²`, `μ₀`, `(a+b)/2`) and every scene still renders.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
brew install mactex-no-gui # macOS
|
|
55
|
+
sudo apt-get install texlive-latex-base texlive-latex-extra texlive-fonts-recommended texlive-science dvisvgm # Debian/Ubuntu
|
|
56
|
+
# Windows: install MiKTeX from https://miktex.org/
|
|
57
|
+
|
|
58
|
+
STATANIM_NO_LATEX=1 manim -ql scene.py MyScene # force the Unicode fallback
|
|
59
|
+
STATANIM_NO_LATEX=0 manim -ql scene.py MyScene # force LaTeX
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
In code: `from statanim.core.latex import set_latex_enabled; set_latex_enabled(False)`.
|
|
63
|
+
|
|
64
|
+
**Docker**
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
docker build -t statanim . # small image, no LaTeX
|
|
68
|
+
docker build -t statanim --build-arg WITH_LATEX=1 . # with LaTeX
|
|
69
|
+
docker run --rm -v "$PWD":/workspace statanim -ql examples/card_probability_scene.py SampleSpaceScene
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Colab**: [open the quickstart notebook](https://colab.research.google.com/github/rishabhbhartiya/STATANIM/blob/main/notebooks/statanim_quickstart.ipynb).
|
|
73
|
+
|
|
74
|
+
**From source**
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/rishabhbhartiya/STATANIM.git
|
|
78
|
+
cd STATANIM
|
|
79
|
+
pip install -e ".[dev]"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
</details>
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Quick start
|
|
87
|
+
|
|
88
|
+
### 1. A video in one line
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from statanim import quick
|
|
92
|
+
|
|
93
|
+
video = quick.anova([5.1, 4.8, 5.6, 5.0], [6.0, 6.4, 5.8, 6.9], [7.9, 8.4, 7.5, 8.8],
|
|
94
|
+
labels=["Control", "Drug A", "Drug B"], title="Do the three groups differ?")
|
|
95
|
+
video.render("medium") # writes an .mp4 and returns its path
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Every call checks its input (counts must be non-negative, ROC labels must contain both classes, ...) and raises a
|
|
99
|
+
clear `ValueError` before rendering. `render()` takes `quality="low|medium|high|4k"`, `output=`, `last_frame=True`
|
|
100
|
+
(a fast PNG preview) and `media_dir=`; `video.scene_class` is a normal Manim scene you can extend or render with the
|
|
101
|
+
`manim` command. Default file names encode the topic and a hash of the data, so videos never overwrite each other.
|
|
102
|
+
|
|
103
|
+
### 2. Your own scene
|
|
104
|
+
|
|
105
|
+
Each topic class puts all its layers in the group from the start, hidden; a `show_*` method returns the animation that
|
|
106
|
+
reveals one layer. You decide the order, the pauses and the captions.
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
import numpy as np
|
|
110
|
+
from manim import *
|
|
111
|
+
from statanim import ANOVA3D
|
|
112
|
+
|
|
113
|
+
class Compare(Scene):
|
|
114
|
+
def construct(self):
|
|
115
|
+
rng = np.random.default_rng(1)
|
|
116
|
+
groups = [rng.normal(m, 1.0, 12) for m in (5, 6.2, 8.0)]
|
|
117
|
+
anova = ANOVA3D(groups, labels=["Control", "Drug A", "Drug B"], y_label="response")
|
|
118
|
+
self.add(anova)
|
|
119
|
+
for step in (anova.show_points, anova.show_group_means, anova.show_grand_mean,
|
|
120
|
+
anova.show_between, anova.show_within, anova.show_result, anova.show_posthoc):
|
|
121
|
+
self.play(step())
|
|
122
|
+
self.wait(0.5)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
manim -ql scene.py Compare
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The newer classes are flat, work in `Scene` and `ThreeDScene`, and stay aligned when you `shift`, `scale` or `move_to` them.
|
|
130
|
+
|
|
131
|
+
### 3. The classic 3-D objects
|
|
132
|
+
|
|
133
|
+
The original statanim objects (`NormalCurve3D`, charts, regression planes, cards, dice, ...) live in 3-D space and need a
|
|
134
|
+
`ThreeDScene` with a camera orientation, otherwise they collapse into a flat line.
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from manim import *
|
|
138
|
+
from statanim import NormalCurve3D
|
|
139
|
+
|
|
140
|
+
class NormalDemo(ThreeDScene):
|
|
141
|
+
def construct(self):
|
|
142
|
+
self.set_camera_orientation(phi=70 * DEGREES, theta=-45 * DEGREES)
|
|
143
|
+
curve = NormalCurve3D(mu=0, sigma=1)
|
|
144
|
+
self.play(Create(curve))
|
|
145
|
+
self.play(FadeIn(curve.shade_region(x_min=-1, x_max=1, scene=self)))
|
|
146
|
+
self.wait(2)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from manim import *
|
|
151
|
+
from statanim import Deck3D, CardFacing, standard_deck
|
|
152
|
+
|
|
153
|
+
class CardDraw(Scene):
|
|
154
|
+
def construct(self):
|
|
155
|
+
deck = Deck3D(cards=standard_deck(shuffle=True, seed=0), initial_facing=CardFacing.FACE_DOWN)
|
|
156
|
+
deck.move_to(LEFT * 3)
|
|
157
|
+
self.play(FadeIn(deck))
|
|
158
|
+
self.play(deck.deal_one(target=RIGHT * 2, flip=True))
|
|
159
|
+
self.wait(2)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## What you can make
|
|
165
|
+
|
|
166
|
+
| Topic | One-liner | Class (own scenes) |
|
|
167
|
+
|---|---|---|
|
|
168
|
+
| Bayesian updating (Beta prior to posterior) | `quick.bayes_update` | `BetaBinomialUpdate3D` |
|
|
169
|
+
| Bayes' theorem with natural frequencies | `quick.bayes_theorem` | `NaturalFrequencyGrid` |
|
|
170
|
+
| One-way ANOVA + Tukey HSD | `quick.anova` | `ANOVA3D` |
|
|
171
|
+
| Chi-square: goodness of fit and independence | `quick.chi_square` | `ChiSquareTest3D` |
|
|
172
|
+
| One-sample z / t test | `quick.hypothesis_test` | `HypothesisTestPlot` |
|
|
173
|
+
| Central Limit Theorem | `quick.clt` | `CLTPlot` |
|
|
174
|
+
| Maximum likelihood estimation | `quick.mle` | `MLE3D` |
|
|
175
|
+
| PCA in 2-D | `quick.pca` | `PCAProjection` |
|
|
176
|
+
| ROC curve and AUC | `quick.roc` | `ROCCurve` |
|
|
177
|
+
| Bias-variance trade-off | `quick.bias_variance` | `BiasVarianceTradeoff` |
|
|
178
|
+
| Simpson's paradox | `quick.simpson` | `SimpsonParadox3D` |
|
|
179
|
+
| Monty Hall | `quick.monty_hall` | `MontyHallSimulation` |
|
|
180
|
+
| ACF / PACF and an AR / ARI forecast | `quick.time_series` | `TimeSeriesDiagnostics` |
|
|
181
|
+
| Normal curve with a shaded probability | `quick.normal` | `NormalCurve3D` |
|
|
182
|
+
|
|
183
|
+
What each video shows, its inputs and the assumptions it does not check are listed in
|
|
184
|
+
[`skills/statanim/references/topics.md`](skills/statanim/references/topics.md); exact signatures are in the
|
|
185
|
+
[API docs](https://statanim.readthedocs.io/en/latest/api/index.html).
|
|
186
|
+
|
|
187
|
+
<details>
|
|
188
|
+
<summary><b>Gallery</b> (14 videos)</summary>
|
|
189
|
+
|
|
190
|
+
| | | |
|
|
191
|
+
|:--:|:--:|:--:|
|
|
192
|
+
| <br>Bayesian updating | <br>ANOVA + Tukey HSD | <br>Chi-square goodness of fit |
|
|
193
|
+
| <br>Chi-square independence | <br>Maximum likelihood | <br>Simpson's paradox |
|
|
194
|
+
| <br>t test | <br>Central Limit Theorem | <br>Bayes, natural frequencies |
|
|
195
|
+
| <br>PCA | <br>Bias–variance | <br>ROC / AUC |
|
|
196
|
+
| <br>Monty Hall | <br>ACF / PACF / forecast | |
|
|
197
|
+
|
|
198
|
+
Regenerate with `python scripts/make_gifs.py`. Scene code: [`examples/topics_quickstart.py`](examples/topics_quickstart.py), [`examples/topics_more.py`](examples/topics_more.py).
|
|
199
|
+
|
|
200
|
+
**Original demos**
|
|
201
|
+
|
|
202
|
+

|
|
203
|
+

|
|
204
|
+

|
|
205
|
+

|
|
206
|
+

|
|
207
|
+
|
|
208
|
+
</details>
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## What's inside
|
|
213
|
+
|
|
214
|
+
| Module | What it gives you |
|
|
215
|
+
|---|---|
|
|
216
|
+
| `distributions` | Normal, Binomial, Poisson, Hypergeometric, Beta, Gamma, Chi-squared, Student-t, F, each with PDF/PMF/CDF visualisers and shadeable regions |
|
|
217
|
+
| `charts` | `BarChart3D`, `Histogram3D`, `BoxPlot3D`, `ViolinPlot3D`, `HeatMap3D`, `ScatterPlot3D`, `LineSeries3D`, `MultiLinePlot3D` |
|
|
218
|
+
| `probability` | `SampleSpace3D`, `VennDiagram3D`, `ProbabilityTree3D`, `BayesBox3D`, plus `BetaBinomialUpdate3D`, `NaturalFrequencyGrid`, `MontyHallSimulation` |
|
|
219
|
+
| `inference` | `HypothesisTest3D`, `ConfidenceInterval3D`, `SamplingDistribution3D`, plus `ANOVA3D`, `ChiSquareTest3D`, `HypothesisTestPlot`, `CLTPlot`, `MLE3D`, `ROCCurve` |
|
|
220
|
+
| `regression` | `RegressionPlane3D`, `ScatterCloud3D`, residual diagnostics, correlation matrices, plus `PCAProjection`, `BiasVarianceTradeoff`, `SimpsonParadox3D`, `TimeSeriesDiagnostics` |
|
|
221
|
+
| `props` | `Card3D`, `Deck3D`, `Coin3D`, `Die3D` (D4, D6, D8, D12, D20), `Spinner3D`, `Urn3D`: physical probability objects with built-in logic |
|
|
222
|
+
| `animations` | `CLTDemo`, `DistMorph3D`, `ParameterSweep3D`, `BootstrapSampling3D`, `ScatterToRegression3D` |
|
|
223
|
+
| `ui` | `Ticker3D`, `PValueTicker3D`, `FormulaPanel3D`, `DataTable3D`, `AnnotationArrow3D` |
|
|
224
|
+
| `core` | Themes (`DARK_THEME`, `LIGHT_THEME`, `PAPER_THEME`, ...), `FlatAxes`, the statistics engine in `math_utils` (tests, OLS, correlations), the LaTeX fallback |
|
|
225
|
+
| `quick` | The one-liner videos |
|
|
226
|
+
|
|
227
|
+
Every public class is importable from the top level (`from statanim import ANOVA3D`); the deep paths
|
|
228
|
+
(`statanim.inference.anova`) keep working. Naming rules and the list of renamed classes and keywords are in
|
|
229
|
+
[API conventions](https://statanim.readthedocs.io/en/latest/api_conventions.html).
|
|
230
|
+
|
|
231
|
+
**Camera orientations for the 3-D objects** (`self.set_camera_orientation(phi=..., theta=...)`)
|
|
232
|
+
|
|
233
|
+
| Scene | phi | theta |
|
|
234
|
+
|---|---|---|
|
|
235
|
+
| 3D bar chart | 65° | -55° |
|
|
236
|
+
| Regression plane | 70° | -45° |
|
|
237
|
+
| Scatter cloud | 70° | -60° |
|
|
238
|
+
| Card grid (table-top) | 60° | -45° |
|
|
239
|
+
| Bivariate normal surface | 68° | -45° |
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Claude skill
|
|
244
|
+
|
|
245
|
+
`skills/statanim/` is an [Agent Skill](https://agentskills.io): it lets Claude (and other agents that support the format)
|
|
246
|
+
turn a request such as "animate whether these three groups differ" into a rendered statistics video. It checks the numbers
|
|
247
|
+
independently, previews the final frame, and reports the statistics and the assumptions behind them.
|
|
248
|
+
|
|
249
|
+
- **claude.ai**: download `statanim.skill` from the [latest release](https://github.com/rishabhbhartiya/STATANIM/releases/latest),
|
|
250
|
+
then Customize → Skills → upload.
|
|
251
|
+
- **Claude Code**: copy `skills/statanim/` to `~/.claude/skills/statanim/`.
|
|
252
|
+
|
|
253
|
+
The skill installs statanim and Manim on first use, so its sandbox needs access to PyPI. Details: [`docs/RELEASING.md`](docs/RELEASING.md).
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Documentation
|
|
258
|
+
|
|
259
|
+
- Docs: <https://statanim.readthedocs.io/en/latest/> (getting started, example gallery, API reference, API conventions)
|
|
260
|
+
- [`docs/reference/API_REFERENCE.md`](docs/reference/API_REFERENCE.md): full class and parameter reference for the classic objects
|
|
261
|
+
- [`CHANGELOG.md`](CHANGELOG.md), [`CONTRIBUTING.md`](CONTRIBUTING.md), [`docs/RELEASING.md`](docs/RELEASING.md)
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Contributing
|
|
266
|
+
|
|
267
|
+
Issues and pull requests are welcome at [github.com/rishabhbhartiya/STATANIM](https://github.com/rishabhbhartiya/STATANIM).
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
git clone https://github.com/rishabhbhartiya/STATANIM.git && cd STATANIM
|
|
271
|
+
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
272
|
+
pip install -e ".[dev]"
|
|
273
|
+
pytest # add --run-render for real renders
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
New topic classes should build on `statanim.core.flat.StagedGroup` / `FlatAxes` and use the naming rules in
|
|
277
|
+
[CONTRIBUTING.md](CONTRIBUTING.md). After adding public classes run `python scripts/gen_exports.py`.
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Acknowledgements
|
|
282
|
+
|
|
283
|
+
Built on [Manim Community](https://www.manim.community/). Statistical algorithms from [SciPy](https://scipy.org/) and
|
|
284
|
+
[NumPy](https://numpy.org/). Inspired by the mathematical animation work of 3Blue1Brown.
|
|
285
|
+
|
|
286
|
+
## License
|
|
287
|
+
|
|
288
|
+
MIT License. See [LICENSE](./LICENSE).
|
|
289
|
+
|
|
290
|
+
**Author:** Rishabh Bhartiya — [rishabh.bhartiya.in@gmail.com](mailto:rishabh.bhartiya.in@gmail.com)
|