statanim 0.1.1__tar.gz → 0.1.2__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.1.2/PKG-INFO +247 -0
- statanim-0.1.2/README.md +212 -0
- {statanim-0.1.1 → statanim-0.1.2}/pyproject.toml +1 -1
- statanim-0.1.2/statanim.egg-info/PKG-INFO +247 -0
- statanim-0.1.1/PKG-INFO +0 -440
- statanim-0.1.1/README.md +0 -405
- statanim-0.1.1/statanim.egg-info/PKG-INFO +0 -440
- {statanim-0.1.1 → statanim-0.1.2}/LICENSE +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/setup.cfg +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/animations/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/animations/clt_demo.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/animations/flip_roll.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/animations/sampling.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/animations/transitions.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/axes/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/axes/axes3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/axes/grid3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/axes/number_plane3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/charts/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/charts/bar_chart3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/charts/box_plot3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/charts/heat_map3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/charts/histogram3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/charts/line_plot3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/charts/scatter_plot3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/charts/violin_plot3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/core/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/core/base.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/core/colors.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/core/math_utils.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/core/tex_utils.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/distributions/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/distributions/base_dist.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/distributions/cdf_viz.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/distributions/continuous_dists.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/distributions/discrete_dists.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/distributions/normal3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/distributions/pdf_viz.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/distributions/pmf_viz.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/inference/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/inference/confidence_interval.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/inference/error_types.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/inference/hypothesis.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/inference/sampling_dist.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/probability/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/probability/bayes.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/probability/prob_tree.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/probability/sample_space.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/probability/venn3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/props/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/props/card.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/props/coin.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/props/die.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/props/spinner.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/props/urn.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/regression/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/regression/correlation.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/regression/regression_plane.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/regression/residuals.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/scenes/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/scenes/demo_bayes.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/scenes/demo_clt.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/scenes/demo_distributions.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/scenes/demo_hypothesis.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/ui/__init__.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/ui/labels.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/ui/panels.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/ui/table3d.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim/ui/ticker.py +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim.egg-info/SOURCES.txt +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim.egg-info/dependency_links.txt +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim.egg-info/requires.txt +0 -0
- {statanim-0.1.1 → statanim-0.1.2}/statanim.egg-info/top_level.txt +0 -0
statanim-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: statanim
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A Manim extension for animated statistical visualisations — distributions, regression, probability, inference and more.
|
|
5
|
+
Author-email: Rishabh Bhartiya <rishabh.bhartiya.in@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/rishabhbhartiya/statanim
|
|
8
|
+
Project-URL: Documentation, https://github.com/rishabhbhartiya/statanim/blob/main/API_REFERENCE.md
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/rishabhbhartiya/statanim/issues
|
|
10
|
+
Project-URL: Source Code, https://github.com/rishabhbhartiya/statanim
|
|
11
|
+
Keywords: manim,statistics,animation,data-science,probability,regression,distribution,education,visualisation,math
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Education
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
17
|
+
Classifier: Topic :: Education
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: manim>=0.18.0
|
|
27
|
+
Requires-Dist: numpy>=1.24
|
|
28
|
+
Requires-Dist: scipy>=1.10
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: build; extra == "dev"
|
|
31
|
+
Requires-Dist: twine; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
<div align="center">
|
|
37
|
+
<img src="https://raw.githubusercontent.com/rishabhbhartiya/STATANIM/main/banner.svg" alt="STATANIM — Statistical Animation for Manim" width="680"/>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div align="center">
|
|
41
|
+
|
|
42
|
+
[](https://pypi.org/project/statanim/)
|
|
43
|
+
[](https://www.python.org/downloads/)
|
|
44
|
+
[](https://www.manim.community/)
|
|
45
|
+
[](./LICENSE)
|
|
46
|
+
|
|
47
|
+
**A Manim extension for animated statistical visualisations.**
|
|
48
|
+
|
|
49
|
+
Distributions, inference, regression, probability theory, and physical props —
|
|
50
|
+
all built on [Manim Community](https://www.manim.community/).
|
|
51
|
+
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Why statanim?
|
|
57
|
+
|
|
58
|
+
Manim is extraordinary at animating mathematics — but when it comes to statistics, you're on your own. Want to show a normal distribution shading its tails as sigma changes? A probability tree that builds itself node by node? A deck of cards dealing out to demonstrate hypergeometric sampling? With vanilla Manim, each of these requires hundreds of lines of low-level geometry code before you even start on the actual statistics.
|
|
59
|
+
|
|
60
|
+
`statanim` closes that gap. It gives statistics the same treatment Manim gives mathematics: objects that *understand* what they represent, animations that carry statistical meaning, and a workflow that stays out of your way so you can focus on the idea you're trying to communicate.
|
|
61
|
+
|
|
62
|
+
Whether you're building lecture slides, making YouTube explainers, or just trying to build intuition for a concept — statanim lets you go from idea to animation in minutes, not days.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Demo
|
|
67
|
+
|
|
68
|
+
**Sample Space**
|
|
69
|
+
|
|
70
|
+

|
|
71
|
+
|
|
72
|
+
**Classical Probability**
|
|
73
|
+
|
|
74
|
+

|
|
75
|
+
|
|
76
|
+
**Conditional Probability**
|
|
77
|
+
|
|
78
|
+

|
|
79
|
+
|
|
80
|
+
**Hypergeometric Distribution**
|
|
81
|
+
|
|
82
|
+

|
|
83
|
+
|
|
84
|
+
**Birthday Paradox**
|
|
85
|
+
|
|
86
|
+

|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Installation
|
|
91
|
+
|
|
92
|
+
**Prerequisites**
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pip install manim
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
LaTeX is required for formula rendering:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# macOS
|
|
102
|
+
brew install mactex-no-gui
|
|
103
|
+
|
|
104
|
+
# Ubuntu / Debian
|
|
105
|
+
sudo apt-get install texlive-full
|
|
106
|
+
|
|
107
|
+
# Windows: install MiKTeX from https://miktex.org/
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Install statanim**
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install statanim
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Install from source**
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
git clone https://github.com/rishabhbhartiya/statanim.git
|
|
120
|
+
cd statanim
|
|
121
|
+
pip install -e .
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Verify**
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from manim import *
|
|
128
|
+
from statanim.props.card import Card3D
|
|
129
|
+
from statanim.distributions.normal3d import NormalCurve3D
|
|
130
|
+
from statanim.core.colors import DARK_THEME
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Quick Start
|
|
136
|
+
|
|
137
|
+
### Normal distribution with shaded region
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from manim import *
|
|
141
|
+
from statanim.distributions.normal3d import NormalCurve3D
|
|
142
|
+
|
|
143
|
+
class NormalDemo(Scene):
|
|
144
|
+
def construct(self):
|
|
145
|
+
axes = Axes(x_range=[-4, 4, 1], y_range=[0, 0.45, 0.1],
|
|
146
|
+
x_length=8, y_length=4)
|
|
147
|
+
curve = NormalCurve3D(mu=0, sigma=1, axes=axes)
|
|
148
|
+
|
|
149
|
+
self.play(Create(axes))
|
|
150
|
+
self.play(Create(curve))
|
|
151
|
+
self.play(curve.shade_region(x_min=-1, x_max=1))
|
|
152
|
+
self.wait(2)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Probability with playing cards
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
from manim import *
|
|
159
|
+
from statanim.props.card import Deck3D, CardFacing, standard_deck
|
|
160
|
+
|
|
161
|
+
class CardDraw(Scene):
|
|
162
|
+
def construct(self):
|
|
163
|
+
deck = Deck3D(cards=standard_deck(shuffle=True, seed=0),
|
|
164
|
+
initial_facing=CardFacing.FACE_DOWN)
|
|
165
|
+
deck.move_to(LEFT * 3)
|
|
166
|
+
self.play(FadeIn(deck))
|
|
167
|
+
self.play(deck.deal_one(target=RIGHT * 2, flip=True))
|
|
168
|
+
self.wait(2)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## What's Inside
|
|
174
|
+
|
|
175
|
+
| Module | What it gives you |
|
|
176
|
+
|---|---|
|
|
177
|
+
| `distributions` | Normal, Binomial, Poisson, Hypergeometric, Beta, Gamma, Chi-squared, Student-t, F — all with PDF/PMF/CDF visualisers and shadeable regions |
|
|
178
|
+
| `charts` | BarChart3D, Histogram3D, BoxPlot3D, ViolinPlot3D, HeatMap3D, ScatterPlot3D, LinePlot3D — statistically correct, 3D-aware |
|
|
179
|
+
| `probability` | SampleSpace3D, VennDiagram3D, ProbabilityTree3D, BayesBox3D — builds event regions and conditional flows step by step |
|
|
180
|
+
| `inference` | HypothesisRegion3D, ConfidenceInterval3D, SamplingDistribution3D, Type I/II error visualisation |
|
|
181
|
+
| `regression` | RegressionPlane3D, ScatterCloud3D, residual diagnostics, correlation matrices, CI/PI shells |
|
|
182
|
+
| `props` | Card3D, Deck3D, Coin3D, Die3D (D4–D20), Spinner3D, Urn3D — physical probability objects with built-in logic and animations |
|
|
183
|
+
| `animations` | CLTDemo, DistMorph3D, ParameterSweep3D, BootstrapSampling3D, ScatterToRegression3D |
|
|
184
|
+
| `ui` | Ticker3D, PValueTicker3D, FormulaPanel3D, DataTable3D, AnnotationArrow3D |
|
|
185
|
+
| `core` | 6 built-in themes (DARK, LIGHT, PAPER, and more), diverging colormaps, 50+ LaTeX formula builders |
|
|
186
|
+
|
|
187
|
+
Full class and parameter documentation: [API_REFERENCE.md](./API_REFERENCE.md)
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Camera Orientation Reference
|
|
192
|
+
|
|
193
|
+
All `ThreeDScene` subclasses need an explicit camera orientation at the top of `construct()`.
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
def construct(self):
|
|
197
|
+
self.set_camera_orientation(phi=70*DEGREES, theta=-45*DEGREES)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
| Scene type | phi | theta |
|
|
201
|
+
|---|---|---|
|
|
202
|
+
| 3D bar chart | 65° | -55° |
|
|
203
|
+
| Regression plane | 70° | -45° |
|
|
204
|
+
| Scatter cloud | 70° | -60° |
|
|
205
|
+
| Card grid (table-top) | 60° | -45° |
|
|
206
|
+
| Bivariate normal surface | 68° | -45° |
|
|
207
|
+
|
|
208
|
+
Use `Scene` (not `ThreeDScene`) for 2D content: PDF curves, PMF bars, Venn diagrams, histograms, box plots, probability trees, and hypothesis test plots.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Development Setup
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
git clone https://github.com/rishabhbhartiya/statanim.git
|
|
216
|
+
cd statanim
|
|
217
|
+
python -m venv .venv
|
|
218
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
219
|
+
pip install -e ".[dev]"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Contributing
|
|
225
|
+
|
|
226
|
+
Issues and pull requests are welcome at
|
|
227
|
+
[github.com/rishabhbhartiya/statanim](https://github.com/rishabhbhartiya/statanim).
|
|
228
|
+
|
|
229
|
+
When adding a new distribution, inherit from `BaseDistribution3D`,
|
|
230
|
+
implement `pdf`/`pmf`, `cdf`, `mean`, `variance`, and add a scene in
|
|
231
|
+
`scenes/demo_distributions.py`.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Acknowledgements
|
|
236
|
+
|
|
237
|
+
Built on [Manim Community](https://www.manim.community/).
|
|
238
|
+
Statistical algorithms from [SciPy](https://scipy.org/) and [NumPy](https://numpy.org/).
|
|
239
|
+
Inspired by the mathematical animation work of 3Blue1Brown.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## License
|
|
244
|
+
|
|
245
|
+
MIT License. See [LICENSE](./LICENSE) for details.
|
|
246
|
+
|
|
247
|
+
**Author:** Rishabh Bhartiya — [rishabh.bhartiya.in@gmail.com](mailto:rishabh.bhartiya.in@gmail.com)
|
statanim-0.1.2/README.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
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://www.python.org/downloads/)
|
|
9
|
+
[](https://www.manim.community/)
|
|
10
|
+
[](./LICENSE)
|
|
11
|
+
|
|
12
|
+
**A Manim extension for animated statistical visualisations.**
|
|
13
|
+
|
|
14
|
+
Distributions, inference, regression, probability theory, and physical props —
|
|
15
|
+
all built on [Manim Community](https://www.manim.community/).
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Why statanim?
|
|
22
|
+
|
|
23
|
+
Manim is extraordinary at animating mathematics — but when it comes to statistics, you're on your own. Want to show a normal distribution shading its tails as sigma changes? A probability tree that builds itself node by node? A deck of cards dealing out to demonstrate hypergeometric sampling? With vanilla Manim, each of these requires hundreds of lines of low-level geometry code before you even start on the actual statistics.
|
|
24
|
+
|
|
25
|
+
`statanim` closes that gap. It gives statistics the same treatment Manim gives mathematics: objects that *understand* what they represent, animations that carry statistical meaning, and a workflow that stays out of your way so you can focus on the idea you're trying to communicate.
|
|
26
|
+
|
|
27
|
+
Whether you're building lecture slides, making YouTube explainers, or just trying to build intuition for a concept — statanim lets you go from idea to animation in minutes, not days.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Demo
|
|
32
|
+
|
|
33
|
+
**Sample Space**
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
**Classical Probability**
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
**Conditional Probability**
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
**Hypergeometric Distribution**
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
**Birthday Paradox**
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
**Prerequisites**
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install manim
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
LaTeX is required for formula rendering:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# macOS
|
|
67
|
+
brew install mactex-no-gui
|
|
68
|
+
|
|
69
|
+
# Ubuntu / Debian
|
|
70
|
+
sudo apt-get install texlive-full
|
|
71
|
+
|
|
72
|
+
# Windows: install MiKTeX from https://miktex.org/
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Install statanim**
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install statanim
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Install from source**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/rishabhbhartiya/statanim.git
|
|
85
|
+
cd statanim
|
|
86
|
+
pip install -e .
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Verify**
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from manim import *
|
|
93
|
+
from statanim.props.card import Card3D
|
|
94
|
+
from statanim.distributions.normal3d import NormalCurve3D
|
|
95
|
+
from statanim.core.colors import DARK_THEME
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Quick Start
|
|
101
|
+
|
|
102
|
+
### Normal distribution with shaded region
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from manim import *
|
|
106
|
+
from statanim.distributions.normal3d import NormalCurve3D
|
|
107
|
+
|
|
108
|
+
class NormalDemo(Scene):
|
|
109
|
+
def construct(self):
|
|
110
|
+
axes = Axes(x_range=[-4, 4, 1], y_range=[0, 0.45, 0.1],
|
|
111
|
+
x_length=8, y_length=4)
|
|
112
|
+
curve = NormalCurve3D(mu=0, sigma=1, axes=axes)
|
|
113
|
+
|
|
114
|
+
self.play(Create(axes))
|
|
115
|
+
self.play(Create(curve))
|
|
116
|
+
self.play(curve.shade_region(x_min=-1, x_max=1))
|
|
117
|
+
self.wait(2)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Probability with playing cards
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from manim import *
|
|
124
|
+
from statanim.props.card import Deck3D, CardFacing, standard_deck
|
|
125
|
+
|
|
126
|
+
class CardDraw(Scene):
|
|
127
|
+
def construct(self):
|
|
128
|
+
deck = Deck3D(cards=standard_deck(shuffle=True, seed=0),
|
|
129
|
+
initial_facing=CardFacing.FACE_DOWN)
|
|
130
|
+
deck.move_to(LEFT * 3)
|
|
131
|
+
self.play(FadeIn(deck))
|
|
132
|
+
self.play(deck.deal_one(target=RIGHT * 2, flip=True))
|
|
133
|
+
self.wait(2)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## What's Inside
|
|
139
|
+
|
|
140
|
+
| Module | What it gives you |
|
|
141
|
+
|---|---|
|
|
142
|
+
| `distributions` | Normal, Binomial, Poisson, Hypergeometric, Beta, Gamma, Chi-squared, Student-t, F — all with PDF/PMF/CDF visualisers and shadeable regions |
|
|
143
|
+
| `charts` | BarChart3D, Histogram3D, BoxPlot3D, ViolinPlot3D, HeatMap3D, ScatterPlot3D, LinePlot3D — statistically correct, 3D-aware |
|
|
144
|
+
| `probability` | SampleSpace3D, VennDiagram3D, ProbabilityTree3D, BayesBox3D — builds event regions and conditional flows step by step |
|
|
145
|
+
| `inference` | HypothesisRegion3D, ConfidenceInterval3D, SamplingDistribution3D, Type I/II error visualisation |
|
|
146
|
+
| `regression` | RegressionPlane3D, ScatterCloud3D, residual diagnostics, correlation matrices, CI/PI shells |
|
|
147
|
+
| `props` | Card3D, Deck3D, Coin3D, Die3D (D4–D20), Spinner3D, Urn3D — physical probability objects with built-in logic and animations |
|
|
148
|
+
| `animations` | CLTDemo, DistMorph3D, ParameterSweep3D, BootstrapSampling3D, ScatterToRegression3D |
|
|
149
|
+
| `ui` | Ticker3D, PValueTicker3D, FormulaPanel3D, DataTable3D, AnnotationArrow3D |
|
|
150
|
+
| `core` | 6 built-in themes (DARK, LIGHT, PAPER, and more), diverging colormaps, 50+ LaTeX formula builders |
|
|
151
|
+
|
|
152
|
+
Full class and parameter documentation: [API_REFERENCE.md](./API_REFERENCE.md)
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Camera Orientation Reference
|
|
157
|
+
|
|
158
|
+
All `ThreeDScene` subclasses need an explicit camera orientation at the top of `construct()`.
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
def construct(self):
|
|
162
|
+
self.set_camera_orientation(phi=70*DEGREES, theta=-45*DEGREES)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
| Scene type | phi | theta |
|
|
166
|
+
|---|---|---|
|
|
167
|
+
| 3D bar chart | 65° | -55° |
|
|
168
|
+
| Regression plane | 70° | -45° |
|
|
169
|
+
| Scatter cloud | 70° | -60° |
|
|
170
|
+
| Card grid (table-top) | 60° | -45° |
|
|
171
|
+
| Bivariate normal surface | 68° | -45° |
|
|
172
|
+
|
|
173
|
+
Use `Scene` (not `ThreeDScene`) for 2D content: PDF curves, PMF bars, Venn diagrams, histograms, box plots, probability trees, and hypothesis test plots.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Development Setup
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
git clone https://github.com/rishabhbhartiya/statanim.git
|
|
181
|
+
cd statanim
|
|
182
|
+
python -m venv .venv
|
|
183
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
184
|
+
pip install -e ".[dev]"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Contributing
|
|
190
|
+
|
|
191
|
+
Issues and pull requests are welcome at
|
|
192
|
+
[github.com/rishabhbhartiya/statanim](https://github.com/rishabhbhartiya/statanim).
|
|
193
|
+
|
|
194
|
+
When adding a new distribution, inherit from `BaseDistribution3D`,
|
|
195
|
+
implement `pdf`/`pmf`, `cdf`, `mean`, `variance`, and add a scene in
|
|
196
|
+
`scenes/demo_distributions.py`.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Acknowledgements
|
|
201
|
+
|
|
202
|
+
Built on [Manim Community](https://www.manim.community/).
|
|
203
|
+
Statistical algorithms from [SciPy](https://scipy.org/) and [NumPy](https://numpy.org/).
|
|
204
|
+
Inspired by the mathematical animation work of 3Blue1Brown.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
MIT License. See [LICENSE](./LICENSE) for details.
|
|
211
|
+
|
|
212
|
+
**Author:** Rishabh Bhartiya — [rishabh.bhartiya.in@gmail.com](mailto:rishabh.bhartiya.in@gmail.com)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "statanim"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
description = "A Manim extension for animated statistical visualisations — distributions, regression, probability, inference and more."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|