A Python toolkit for producing publication-quality microeconomics diagrams.
Project description
A Python toolkit for producing publication-quality microeconomics diagrams. Define utility functions declaratively, solve for consumer equilibria, and export figures as PNG, PDF, or SVG — all in a few lines of code.
Installation
pip install econ-viz
Requires Python 3.12 or later.
Quick Start
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, x_label="x", y_label="y",
title="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")
Notebook
The project ships with an interactive playground notebook:
notebook/econ-viz Playground.ipynb
Download it and open it in Jupyter, VS Code, or Colab. The first code cell upgrades econ-viz from PyPI for fresh runtimes.
Highlights
- Built-in models: Cobb-Douglas, Leontief, Perfect Substitutes, CES, Satiation, Quasi-Linear, Stone-Geary, and Translog
- Solver support for interior, kink, boundary, and corner solutions
- Closed-form demand helpers with
solution_tex(...) - Comparative tools including
comparative_statics(...)andslutsky_matrix(...) - Multi-panel
Figurelayouts,PricePath/IncomePath, and linkedDemandDiagram - CLI support for plotting and closed-form demand output
Additional Tools
Closed-form Marshallian demand in TeX:
from econ_viz import solution_tex
from econ_viz.models import CobbDouglas
tex = solution_tex(CobbDouglas(alpha=0.4, beta=0.6))
Slutsky matrix:
from econ_viz import slutsky_matrix
from econ_viz.models import CobbDouglas
S = slutsky_matrix(CobbDouglas(alpha=0.4, beta=0.6), px=2.0, py=3.0, income=60.0)
# S.s_xx, S.s_xy, S.s_yx, S.s_yy
CLI
econ-viz help
econ-viz models
econ-viz solve-tex --model cobb-douglas --symbolic-params
Plotting example:
econ-viz plot --model cobb-douglas --alpha 0.5 --beta 0.5 \
--px 2 --py 3 --income 30 \
--fill --show-ray \
--output cobb_douglas.png
Documentation
Full documentation lives at econ-viz.org.
License
MIT © Anthony Sung
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file econ_viz-1.3.1.tar.gz.
File metadata
- Download URL: econ_viz-1.3.1.tar.gz
- Upload date:
- Size: 53.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83817e45832559cceaff9168428de1547f67a5b1f73faecd84452b8d2115c37f
|
|
| MD5 |
a1315e80416c80ef469839320d3601b9
|
|
| BLAKE2b-256 |
69329ffea8cb88f87df47a6abede7dca3f0f4ab78c7da26dcdb34645caa31ab5
|
Provenance
The following attestation bundles were made for econ_viz-1.3.1.tar.gz:
Publisher:
publish.yml on EconViz/econ-viz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
econ_viz-1.3.1.tar.gz -
Subject digest:
83817e45832559cceaff9168428de1547f67a5b1f73faecd84452b8d2115c37f - Sigstore transparency entry: 1224760716
- Sigstore integration time:
-
Permalink:
EconViz/econ-viz@7d87da44917c12566fbd1b50bfc4191b6bc8ffbb -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/EconViz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7d87da44917c12566fbd1b50bfc4191b6bc8ffbb -
Trigger Event:
push
-
Statement type:
File details
Details for the file econ_viz-1.3.1-py3-none-any.whl.
File metadata
- Download URL: econ_viz-1.3.1-py3-none-any.whl
- Upload date:
- Size: 74.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bc19e44bb42055fedb12af72947e7b22bdaac0d4112014ab337cd875649c4a9
|
|
| MD5 |
6dd3f7b243826373c39a3a809229eaee
|
|
| BLAKE2b-256 |
b2f95d470bf2d7310bbd8252492b69b565d3637f8be14aa1069bcddeff7f94e9
|
Provenance
The following attestation bundles were made for econ_viz-1.3.1-py3-none-any.whl:
Publisher:
publish.yml on EconViz/econ-viz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
econ_viz-1.3.1-py3-none-any.whl -
Subject digest:
1bc19e44bb42055fedb12af72947e7b22bdaac0d4112014ab337cd875649c4a9 - Sigstore transparency entry: 1224760771
- Sigstore integration time:
-
Permalink:
EconViz/econ-viz@7d87da44917c12566fbd1b50bfc4191b6bc8ffbb -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/EconViz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7d87da44917c12566fbd1b50bfc4191b6bc8ffbb -
Trigger Event:
push
-
Statement type: