Foundations of Computational Economics #16

by Fedor Iskhakov, ANU

Visualization of data and solutions

Description: Principles and functions of graphics. Examples of visualization of economic models.

Why visualize?

  1. Convey ideas to others Ability to efficiently explain your idea/work to other busy people is crucial element of success in many fields
  2. Check your own work Creating of new knowledge using computational tools requires absolute certainty in the code
  3. Aggregate large amounts of information Makes it possible to get the big picture and the message behind it

Matplotlib and other libraries

  • matplotlib - Python library that abstracts from the graphical backbone of each system and ensures code mobility

Matplotlib thumbnail gallery


  1. Visualization examples from my own research projects
  2. Links to compulsory online learning resources

Graphical objects

Extensive collection of objects to modify all aspects of the graphics

  • figure - axes - subplots
  • lines - polygons (patches)
  • fill color and edge color
  • annotations and other text

Types of plots

  • bar - categorical data, histograms
  • scatter - individual data points
  • line - continuous measure
  • area - dynamics of composition
  • pie - static composition
  • Sankey - flow diagram

How to choose the plot type

  1. Number of variables to be represented
  2. Type of variables
    • continuous
    • categorical
    • ordered
  3. What is the message of the graphics?

General tips

  1. Less visual clutter!
    Every dot, line, shape and label has to convey useful information
  2. Read the the manual and change the options
    Defaults are good for quick and dirty preliminary runs only
  3. Careful with 3D
    Much harder to make clear
  4. “Animations”
    May be useful in cases when there are one too many dimensions in the data to visualize

Less visual clutter

Choice of appropriate plot type

Using many dimensions in one plot

  • location (x,y,z)
  • color
  • line or marker style
  • size
  • animation
  • multiple plots in a figure

Visual debugging and dashboards

Using visual representation to verify the code

  • Seeing a bug in a plot is easier than in the code!

Dashboards are ideal for aggregation of large amounts of information

  1. Calibration/estimation an moment matching
  2. Monitoring computing resources

Visualizing economic model for new insights

Tutorials for compulsory self-study

Further learning resources