Home
A Python toolkit for producing publication-quality microeconomics diagrams.
Documentation: https://econ-viz.org
Source Code: https://github.com/EconViz/econ-viz
from econ_viz import Canvas, levels, solve
from econ_viz.models import CobbDouglas
model = CobbDouglas(alpha=0.5, beta=0.5)
eq = solve(model, px=2.0, py=3.0, income=30.0)
lvls = levels.around(eq.utility, n=5)
cvs = Canvas(x_max=20, y_max=15, title=r"Cobb-Douglas $x^{0.5} y^{0.5}$")
cvs.add_utility(model, levels=lvls)
cvs.add_budget(2.0, 3.0, 30.0, fill=True)
cvs.add_equilibrium(eq, show_ray=True)
cvs.save("cobb_douglas.png")
Features
-
Six built-in utility models
Cobb-Douglas, Leontief, Perfect Substitutes, CES, Satiation, and Quasi-Linear — covering the full range of standard microeconomic preferences.
-
Automatic equilibrium solving
Interior solutions, kinked optima (Leontief), and corner solutions — all handled via SLSQP with no manual setup required.
-
LaTeX parser
Pass a LaTeX expression like
x^{0.4} y^{0.6}directly and get back a fully-configured model instance. -
Publication-ready export
Save as PNG, PDF, or SVG for presentations, or export TikZ/PGFPlots source to embed directly in LaTeX documents.
-
Advanced models
Wrap any callable as a utility function, or extend to N goods with 2-D projection via
MultiGoodCD.freeze(). -
CLI
Generate diagrams from the terminal without writing a single line of Python.
Install
Requires Python 3.12 or later.