Skip to main content

Animated economics diagrams for Manim — AD-AS, IS-LM, Solow, Supply & Demand with equilibrium markers, shift animations, and linked multi-panel layouts

Project description

manim-ec

Animated economics diagrams built on Manim Community. Create publication-quality animations of core macro and micro models with a few lines of Python.

Models

Diagram Class Key curves
Supply & Demand SupplyDemandDiagram S, D with equilibrium
AD-AS ADASDiagram AD, SRAS, LRAS with demand/supply shocks + long-run adjustment
IS-LM ISLMDiagram IS, LM with monetary & fiscal policy shifts
Solow Growth SolowDiagram f(k), sf(k), (δ+n+g)k with savings & depreciation shocks
Linked IS-LM / AD-AS LinkedISLM_ADAS Side-by-side IS-LM and AD-AS that shift simultaneously

Installation

pip install manim-ec

Or for development:

git clone https://github.com/ddzhang04/manim_ec.git
cd manim_ec
uv sync

Quick start

from manim import Create, Scene, Write, Text, UP
from manim_ec import ADASDiagram

class AdverseSupplyShock(Scene):
    def construct(self):
        diagram = ADASDiagram(numbered_eq=True)
        self.play(Create(diagram))
        self.wait()

        for anim in diagram.adverse_supply_shock(sras_price=6, show_arrows=True):
            self.play(anim)
            self.wait(0.5)
manim render -ql my_scene.py AdverseSupplyShock

Features

Equilibrium markers — automatic intersection detection with dashed projection lines and labeled axes.

Numbered equilibria — pass numbered_eq=True to get subscripted labels (P₁/Y₁ → P₂/Y₂) that persist across shifts so you can see before and after.

Axis arrows — pass show_arrows=True to any shift method to draw arrows on the axes showing the direction of change.

Long-run adjustment — AD-AS demand and supply shocks support long_run=True (default) to animate SRAS gradually returning to potential output.

Linked diagramsLinkedISLM_ADAS places IS-LM and AD-AS side by side. Policy shifts animate both diagrams simultaneously.

Examples

All examples are in the examples/ directory:

# AD-AS shocks
manim render -ql examples/ad_as_example.py AdverseSupplyShock

# IS-LM monetary expansion
manim render -ql examples/is_lm_example.py MonetaryExpansion

# Solow savings increase
manim render -ql examples/solow_example.py IncreaseSavings

# Linked IS-LM + AD-AS
manim render -ql examples/linked_example.py LinkedMonetaryExpansion

API reference

Common options (all diagrams)

Parameter Description
show_equilibrium=True Mark the initial equilibrium with dot + dashed lines
numbered_eq=False Use subscripted labels (P₁, Y₁) instead of P*, Y*
show_arrows=False Draw axis arrows showing direction of equilibrium change
x_range, y_range Override axis ranges (e.g. [0, 10, 1])
x_length, y_length Override axis display size

ADASDiagram

ADASDiagram(m=20, v=1, sras_price=4, lras_y=5,
            sras_only=False, lras_only=False)

# Shift individual curves
diagram.shift_ad(m=30, show_arrows=True)
diagram.shift_sras(sras_price=6)
diagram.shift_lras(new_y=7)

# Convenience shock methods (return list of animations)
diagram.positive_demand_shock(m=30, long_run=True, show_arrows=True)
diagram.negative_demand_shock(m=12)
diagram.adverse_supply_shock(sras_price=6)
diagram.positive_supply_shock(sras_price=2)

ISLMDiagram

ISLMDiagram(a=9.5, b=1.5, ms=2, k=1, h=1)

diagram.shift_is(a=13, show_arrows=True)
diagram.shift_lm(ms=5)

diagram.monetary_expansion(ms=5, show_arrows=True)
diagram.monetary_contraction(ms=1)
diagram.fiscal_expansion(a=13)
diagram.fiscal_contraction(a=6)

SolowDiagram

SolowDiagram(s=0.3, alpha=0.5, delta=0.1, n=0.05, g=0.05,
             show_production=True)

diagram.shift_savings(s=0.5, show_arrows=True)
diagram.shift_breakeven(delta=0.15, n=0.08)

diagram.increase_savings(s=0.5, show_arrows=True)
diagram.decrease_savings(s=0.15)
diagram.population_growth(n=0.1)
diagram.increase_depreciation(delta=0.2)

LinkedISLM_ADAS

LinkedISLM_ADAS(numbered_eq=True, show_arrows=True, spacing=1.0)

linked.monetary_expansion(ms=5, m=30)
linked.monetary_contraction(ms=1, m=10)
linked.fiscal_expansion(a=13, m=30)
linked.fiscal_contraction(a=6, m=12)
linked.adverse_supply_shock(sras_price=6)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manim_ec-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

manim_ec-0.1.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file manim_ec-0.1.0.tar.gz.

File metadata

  • Download URL: manim_ec-0.1.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for manim_ec-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bdbfe0308684279e9ff53b743175fc6036699a94ca55bb9b1fa381e9109c1d9e
MD5 d715668843e17e70add6744b2fa454cd
BLAKE2b-256 5f11a901ecd977f1b294442143ec49abc343e7b25e3fb21c58a59d00509ee2f7

See more details on using hashes here.

File details

Details for the file manim_ec-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: manim_ec-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for manim_ec-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8a9e688af022be2c158582d8bc8ae517e81e7b26a9002945ad783cf71b642ab
MD5 f6c1c21df96551a22ecf0bc21d66d285
BLAKE2b-256 f183e08078600ff4325bb521d28da0c1245bdaa9569aceace20c16a5509e2797

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page