Skip to content

Introduction

principle-viz is a Python package for the diagrams of a principles-of-economics course: supply and demand, equilibrium and its shifts, taxes and subsidies, price controls, welfare, international trade, market failures, factor markets and the production possibilities frontier. Each topic has a calculation, which returns numbers, and a figure drawn in textbook conventions.

Figures are written as PNG, SVG or PDF; the command-line tool prints calculation results as JSON.

principle-viz belongs to the EconViz family of packages and draws with mosaickit, a domain-independent scene and drawing library. Its sibling utility-viz is a microeconomics package covering utility models, optimal-bundle solving, indifference curves, budget lines, consumer equilibrium, demand curves and Edgeworth boxes; principle-viz does not include these.

Scope

principle-viz handles linear markets, and its features fall into four parts: markets, policy, applications and tools. Calculations and figures can be used separately: a result can be printed, written as JSON or passed to MarketFigure to be drawn.

Reading guide

The manual is organized in four parts: markets, policy, applications and tools (see Chapter guide).

Part Topic Description
Markets Linear markets Lines, equilibrium and shifts
Discrete markets Unit-by-unit demand and supply schedules
Market curves from individuals Horizontal sum of individual curves
Elasticity and total revenue Point and arc elasticity, total revenue curve
Policy Welfare Consumer surplus, producer surplus and deadweight loss
Taxes and subsidies Tax wedge and subsidy cost
Price controls Price ceilings, price floors and shortages
Applications International trade Free trade, tariffs and import quotas
Market failures Externalities, common resources and public goods
Labor and loanable funds Minimum wage and government borrowing
Production possibilities Opportunity cost, growth and comparative advantage
Tools Figures Labels, layers and palettes
Command line Calculation results as JSON

On first use, read Quick start, Linear markets and Figures in that order. Each later chapter covers one topic: the calculation first, then the figure. For the options of a specific command, go to Command-line interface.

The scripts that draw the figures of this manual come as one zip, sorted by topic: principle-viz-examples.zip.

Comments