Plotting survey data: A wrapper for catplot

The previous post and the one before that mentioned that plotting survey data, which often contains ordinal or low-dimensional nominal data, can take many Stata options. I have started working on a wrapper for Nick Cox’s catplot command to bring down the code to one-line commands that produce graphs like the following examples:

svyplot marital, ymax(60)

The example above is close to the default catplot output with one variable. With two variables, I have tried to implement degrading colors as shown in the work of the Oxford Internet Institute:

svyplot health race, asc red ymax(60)

The wrapper uses reds or blues (default) for the color gradients, which can be ascending (default) or descending. The ymax option controls the height of the graph, which is 100 by default, in order to fit stacked bars:

svyplot happy polviews, des stack angle(25) scheme(burd3)

The graph above uses the BuRd scheme. It shows the data that was used to claim that the Tea Party members are the happiest Americans — which is false, as you can see by plotting the full data.

svyplot inequal3 race, asc hor stack scheme(burd5)

This final example shows stacked horizontal bars. The wrapper code probably won’t behave well with recast(dot) and three-variable arrangements, even though both are supported.