Skip to content

Command-line interface

The command-line interface plots diagrams, runs batches and prints demand formulas. Install it as a standalone tool with uv tool install utility-viz, or prefix each command with uv run inside a uv project (Installing the command-line tool). The 1.x command econ-viz, installed by the econ-viz compatibility distribution, still works in 2.x: it warns that it is deprecated and runs utility-viz with the same arguments (Migrating from econ-viz).

Show help for the CLI or a specific command

List all supported utility models

Generate and export a diagram

Print a closed-form Marshallian demand as TeX

Create an econ-viz.toml configuration template

Help and models

utility-viz help [command]

Without an argument, list all commands; with one, show its options.

utility-viz help          # all commands
utility-viz help plot     # plot options
utility-viz help models   # models options
utility-viz models

List the model names and parameters the CLI supports. --model takes kebab-case names, which differ from the Python class names (CLI models). The parameter options are described in Plotting.

--modelvalue</span>cobb-douglas`

Required alpha, beta

Optional --

--modelvalue</span>ces`

Required rho

Optional alpha, beta

--modelvalue</span>leontief`

Required a, b

Optional --

--modelvalue</span>perfect-substitutes`

Required a, b

Optional --

--modelvalue</span>satiation`

Required bliss-x, bliss-y

Optional a, b

--modelvalue</span>quasi-linear`

Required --

Optional v-func, linear-in

--modelvalue</span>stone-geary`

Required --

Optional alpha, beta, bar-x, bar-y

--modelvalue</span>translog`

Required --

Optional alpha-0, alpha-x, alpha-y, beta-xx, beta-yy, beta-xy

Plotting

utility-viz plot --model name options
utility-viz plot --latex expression options

Model name; utility-viz models lists them all.

LaTeX expression for Cobb-Douglas, perfect complements, perfect substitutes or CES (LaTeX parsing).

Price of good \(x\).

Price of good \(y\).

Consumer income.

--alphaDefault: 0.5

Alpha parameter (Cobb-Douglas, CES).

--betaDefault: 0.5

Beta parameter (Cobb-Douglas, CES).

--aDefault: 1.0

Parameter \(a\) (perfect complements, perfect substitutes, satiation).

--bDefault: 1.0

Parameter \(b\) (perfect complements, perfect substitutes, satiation).

--rhoDefault: 0.5

Substitution parameter (CES).

--bliss-xDefault: 5.0

Bliss-point \(x\)-coordinate (satiation).

--bliss-yDefault: 5.0

Bliss-point \(y\)-coordinate (satiation).

--v-funcDefault: log

Non-linear function of the quasi-linear model, log or sqrt.

--linear-inDefault: y

Good that enters the quasi-linear model linearly, x or y.

--bar-xDefault: 1.0

Stone-Geary subsistence quantity \(\overline{x}\).

--bar-yDefault: 1.0

Stone-Geary subsistence quantity \(\overline{y}\).

--alpha-0Default: 0.0

Translog intercept.

--alpha-xDefault: 0.5

Translog first-order weight on \(\ln x\).

--alpha-yDefault: 0.5

Translog first-order weight on \(\ln y\).

--beta-xxDefault: 0.0

Translog curvature in \(x\).

--beta-yyDefault: 0.0

Translog curvature in \(y\).

--beta-xyDefault: 0.0

Translog interaction between \(x\) and \(y\).

--x-maxDefault: 10

Horizontal axis limit.

--y-maxDefault: 10

Vertical axis limit.

--x-labelDefault: x

Horizontal axis label.

--y-labelDefault: y

Vertical axis label.

Figure title.

Theme name: manual, default, colorblind, monochrome, nord, paper or presentation (Themes and configuration). Without it, the base of the configuration file.

Path to a TOML configuration file. Command-line options take precedence over the file. Without it, econ-viz.toml (or the older utility-viz.toml) in the current directory is used if present (File lookup). Relative font paths are read from the folder of the file.

--n-curvesDefault: 5

Number of indifference curves.

--dpiDefault: 300

Raster output resolution.

Shade the feasible set below the budget line.

Draw the expansion-path ray through the optimum.

Omit the budget line.

Omit the equilibrium point.

Omit the indifference curves.

Output file (.png, .pdf, .svg, .tex); omit it to open an interactive window.

Give the model with --model, or the utility function with --latex, not both. With --output the diagram is written to a file; without it an interactive window opens.

The budget line and equilibrium need both prices and income. --no-budget, --no-equilibrium and --no-curves each omit one layer and can be combined (Layer options).

Case Result
--px, --py and --income all given Budget line drawn and equilibrium solved
Any price or income missing Indifference curves only, no budget line or equilibrium
--no-equilibrium added No solve and no equilibrium, even with prices and income
--no-budget added Budget line hidden, even with prices and income
--no-curves with prices and income Budget line and equilibrium only, no indifference curves
# named model
utility-viz plot --model cobb-douglas --alpha 0.5 --beta 0.5 ...

# LaTeX expression
utility-viz plot --latex "x^{0.4} y^{0.6}" ...
# Cobb-Douglas, shaded budget set
utility-viz plot --model cobb-douglas --alpha 0.5 --beta 0.5 \
              --px 2 --py 3 --income 30 \
              --fill --output cobb_douglas.png

# LaTeX input, Nord theme, expansion path
utility-viz plot --latex "x^{0.4} y^{0.6}" \
              --px 2 --py 3 --income 30 \
              --theme nord --show-ray \
              --output cd_latex.png

# perfect complements, larger canvas
utility-viz plot --model leontief --a 1 --b 2 \
              --px 2 --py 3 --income 30 \
              --x-max 20 --y-max 15 \
              --output leontief.png

# CES, curves only
utility-viz plot --model ces --rho -0.5 \
              --x-max 20 --y-max 15 --n-curves 6 \
              --no-budget --no-equilibrium \
              --output ces.png

# satiation (bliss point)
utility-viz plot --model satiation --bliss-x 6 --bliss-y 4 \
              --x-max 12 --y-max 10 \
              --no-budget --no-equilibrium \
              --output satiation.png

# no --output: open a window
utility-viz plot --model cobb-douglas --px 2 --py 3 --income 30

Model selection

Prices and income

Model parameters

Quasi-linear, Stone-Geary and Translog take these further options:

utility-viz plot --model stone-geary --bar-x 2 --bar-y 2 \
              --px 2 --py 3 --income 30 \
              --x-max 20 --y-max 15 --output stone_geary.png

Subsistence spending here is \(2 \times 2 + 3 \times 2 = 10\), below the income of \(30\). With an income of \(10\) or less, the solve fails because the budget lies outside the model's domain.

Canvas and layers

For batch runs, give each parameter set its own file name and create the output directory first. --x-max and --y-max do not follow the prices; when an intercept or the optimum falls outside the canvas, raise the limits as well.

Creating a configuration file

utility-viz init [path] [--force] [--migrate]

Write a commented econ-viz.toml template: the shared settings at the top level and utility-viz's own under [utility]. Without a path it goes in the current directory; an existing file is overwritten only with --force. --migrate instead moves utility-viz's top-level tables under [utility], keeping the comments: it rewrites a utility-viz.toml in the same directory into econ-viz.toml and keeps the old file, or, without one, rewrites an old-layout econ-viz.toml in place.

utility-viz init
utility-viz init config/figures.toml
utility-viz init --migrate
utility-viz plot --config econ-viz.toml --model cobb-douglas \
              --px 2 --py 3 --income 30 --output figure.png

Demand formulas

utility-viz solve-tex --model name options

Keep model parameters as symbols, such as \(\alpha\) and \(\beta\); without it the given values are substituted.

--px-symbolDefault: p_x

Symbol for the price of \(x\).

--py-symbolDefault: p_y

Symbol for the price of \(y\).

--income-symbolDefault: I

Symbol for income.

Print the closed-form Marshallian demand as TeX, for any document that supports TeX math.

# numeric parameters
utility-viz solve-tex --model cobb-douglas --alpha 0.4 --beta 0.6

# symbolic parameters
utility-viz solve-tex --model cobb-douglas --symbolic-params

# custom price and income symbols
utility-viz solve-tex --model leontief --a 2 --b 3 \
                   --px-symbol p_1 --py-symbol p_2 --income-symbol M

Supports cobb-douglas, leontief, perfect-substitutes and their LaTeX expressions. The command prints the formula only and writes no figure.

Comments