Source code for the animated scenes in my YouTube video on Statistical Process Control (SPC), made for my Probability & Statistics class.
The animations are built with Manim Community Edition, the Python library originally created by 3Blue1Brown for programmatically generating math/science visualizations.
The video (and this code) walks through:
- What SPC is — using statistical techniques to monitor and control a process, with the goal of maintaining quality, improving efficiency, and reducing downtime/costs.
- The Central Limit Theorem — the statistical foundation that control charts rely on, illustrated by drawing out the normal distribution curve.
- Control charts — what they are and why they're used across engineering fields to track how a process changes over time.
- Special cause vs. common cause variation — external/assignable causes vs. internal/inherent causes of process variation.
- Choosing a control chart — how the discrete-vs-continuous nature of your data (and sample size) determines which chart to use, covering X-MR/IMR, X̄-R, X̄-S charts for continuous data, and c-, u-, np-, and p-charts for discrete/attribute data.
| File | Scene | Description |
|---|---|---|
Scene1 Redo.py |
Intro | Title animation and a bulleted definition of SPC. |
Scene2.py |
CLT | Plots a normal distribution PDF to introduce the Central Limit Theorem. |
Scene3.py |
Main content | Control charts, special vs. common cause variation, and how to pick a chart type based on your data. |
- Python 3.9+
- Manim Community Edition (this project uses LaTeX-based
Tex/BulletedListmobjects, so you'll also need a LaTeX distribution — e.g. MiKTeX/TeX Live — installed and on your PATH)
Install Manim:
pip install manimNote:
Scene3.pyreferences a handful of image assets (egncat,accelerator,wafer,M3_base,coll_pcore,fpga_sim_results,variation) that aren't included in this repo. You'll need to supply your own images with matching filenames in the working directory to render that scene as-is.
Render a scene at draft quality (fast, lower resolution):
manim -pql "Scene1 Redo.py" Scene1_redo
manim -pql Scene2.py Scene2
manim -pql Scene3.py Scene3Swap -pql for -pqh (high quality) once you're happy with the result. The -p flag auto-plays the video after rendering; drop it to just render.
This code was written to produce one specific video rather than as a reusable library — scene structure, timing (self.wait(...)), and layout are tuned to match the narration, not meant to be a general-purpose SPC toolkit. Feel free to fork it if you want to adapt the visuals for your own project.
Claude AI was used to draft the README.MD file. The Coll e and p core images were sourced from Geekerwan youtube channel. The apple M3 base die shot image was sourced from HighYeild youtube channel. All the actual code is my own. I'm releasing the code under the MIT license.