cleanplots: Stata graphics scheme

Overview

cleanplots is a Stata graphics scheme to change the default look of Stata graphics. It is designed to implement data visualization best practices by default—limiting the amount of time you have to spend tweaking the graph to be maximally readable and usable. It is especially designed for better and easier default graphs of predictions and marginal effects.

The sections below detail (1) installation instructions, (2) the help file, (3) features of the graphics scheme, and (4) examples that compare cleanplots to Stata's default graphics scheme.

(1) Installation Instructions

To install in Stata:

net install cleanplots, from("https://tdmize.github.io/data/cleanplots")

Once installed, to change your graphics scheme:

set scheme cleanplots, perm

(2) Help file

Read the cleanplots help file by executing the following command (also available here):

help cleanplots

(3) Details on cleanplots scheme.

cleanplots implements a host of features that draw on best data visualization practices (some of which are borrowed from the excellent black and white graphics scheme plainplots from Bischof (2017)). This allows you to make publication quality Stata graphics with very little effort. With cleanplots, many of the defaults you would change before via code are already changed for you. For example:

  1. Default colors are easier to distinguish from each other and are more aesthetically pleasing

  2. Default colors allow you to make one graph which is effective in both color and when printed in black and white

  3. Marker shapes and line features (e.g. solid, dashed, etc.) better distinguish lines and ensure lines will be distinguishable if printing in black and white

  4. All axis markers are horizontal – thus easier to read

  5. A non-invasive light grid is placed on all plots

  6. Both vertical and horizontal gridlines

  7. The background of the plot is white

  8. Legends are placed to right of the graph

  9. Text colors on the graph are consistent

  10. And many more!


Color figures convert automatically to grayscale

One benefit of the cleanplots scheme is that you only need to create one set of figures because the colors and markers/symbols/lines cleanplots uses can be printed in black and white/grayscale and still be easily distinguished. The figures below illustrate the color and grayscale version of the same figures:

Creating figures considerate of colorblindness

About 5% of the population has some form of colorblindness (red/green being the most common which is why you should always avoid having red and green together on your figure). This excellent website Coloring for Colorblindness lets you check your color schemes to see how they will be viewed for those who are colorblind.

The figure below shows how the first four default cleanplots colors ("true") look to individuals with various types of colorblindness. As the figure illustrates, the colors have been chosen because they are easily distinguishable across all types of colorblindness.

(4) Examples

This section illustrates default choices of some common plots using cleanplots (on the left) vs Stata's default graphics scheme (s2color; on the right). Note I recommend more polished figures for use in papers; these are only meant to illustrate the difference in the default choices.

hist vidtv, percent

marginsplot, recastci(rline) ciopts(lpat(dash))

twoway scatter residstd index [w=influence]

marginsplot, recast(scatter) x(educ)

cibar income, over1(degree) over2(woman)

lowess job phd