Chad's Matlab Functions

Chad Jones


These are simple matlab functions that I've found useful over the years. Many of these are used to produce nice-looking graphics that I use in my papers and books. Click on each file name to download a particular function, or here for a zip file containing all the functions.

(For publication-quality graphs, I often find it necessary to move some of the text around by "hand," e.g. for the names in plotnamesym or even for the y-axis titles occasionally.)

My most useful routines:

chadfig.m: Produces nice figures

plotnamesym.m: Creates a plot using the names 'names' and symbols in the graph

cshow.m: Displays a matrix, with optional row and column headings and formatting

Other routines:

chadgraph.m: Turns off the axis labels, e.g. for xfig like graphs

dynarrow.m: Draws "dynamic arrows" (like Solow diagram) from point a to point b

figlines.m: Adds dashed lines from (x,ymin) to (x,y) and (xmin,y) to (x,y)

figsetup.m: Like clf, but also enlarges the fig window so it is closer to wysiwyg

makefigwide.m: Call to stretch the width of the figure - good for printing GDP per capita over a long period of time, or for time series line plots

plotlog.m: Plots y vs x with y on a log scale (natural log)

plotname.m: Creates a plot using the names 'names' instead of plot symbols in the graph. Works best if names are only two or three characters long

shade.m: Shades between the start and finish (which are are Nx1 vectors of starting and ending years) pairs using colorstr

shadenber.m: Routine to shade the nberdates in a figure. See also nberdates.m, which contains the nber recession dates themselves.