cleanplots

Stata and R graphics schemes for easy and effective data visualizations

cleanplots is a Stata and R graphics scheme that changes the default look of Stata graphics and of R graphics made with ggplot. It is designed to implement data visualization best practices by default – limiting the amount of time you have to spend tweaking a graph to be maximally readable and usable. The color palette is chosen to be colorblind friendly and to work when printed in black and white, so that a single figure will do for both color and grayscale.

This page covers the Stata scheme. The companion R package is documented at trentonmize.com/software/cleanplots_r.

Installation

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

To make cleanplots the scheme for all of your graphs:

set scheme cleanplots, perm

Or apply it to a single graph with the scheme() option:

sysuse auto, clear
graph twoway scatter price weight, scheme(cleanplots)

To read the help file in Stata, type help cleanplots; it is also on this site.

Citation

In general, I do not think the use of a graphics scheme requires citation. So for most cases, feel free to use cleanplots without citation. But, if you need or want a citation you can cite cleanplots as:

Mize, Trenton D. 2017. “cleanplots: Stata graphics scheme for easy and effective data visualizations.” https://www.trentonmize.com/software/cleanplots

If you use the ordinal cleanplots# schemes, please also credit the cividis colors (Nunez, Anderton, and Renslow 2018) or the viridis colors (van der Walt and Smith 2015); references below.

What cleanplots changes

  • Default colors are easier to distinguish from each other and are more aesthetically pleasing.
  • Default colors are colorblind friendly.
  • Default colors allow you to make one graph which is effective in both color and when printed in black and white.
  • Nominal and ordinal color palettes are available so your colors match your data, with ordinal schemes for 2 to 15 ordered categories.
  • Marker shapes and line features (e.g. solid, dashed) better distinguish lines and ensure lines will be distinguishable if printing in black and white.
  • All axis markers are horizontal, and thus easier to read.
  • A non-invasive light grid is placed on all plots, with both vertical and horizontal gridlines.
  • The background of the plot is white.
  • Legends are placed to the right of the graph, close to the data.
  • Text colors on the graph are consistent.
  • Bar charts, area plots, and pie charts automatically use softer versions of the colors, since these elements use far more ink than points and lines.
  • And many more.

The Examples page shows six common graphs drawn with cleanplots next to the same graphs in Stata’s traditional scheme s2color.

The colors

The ten main colors are used, in order, for markers, lines, and confidence intervals. Beyond the first few, distinct marker symbols and line patterns carry most of the work of telling groups apart, since color alone reliably distinguishes about four or five groups. The palette, with its RGB and hex codes (drawn with the colorpalette command):

colorpalette #D50000 #8FC6EB #000000 #909090 #740074 #FFB3D9 ///
             #143755 #C0C0C0 #404040 #D9D7F0, rows(5) ///
     title("cleanplots main color palette" "RGB and Hex codes shown")

The ten cleanplots colors as swatches in two columns of five, each labeled with its RGB and hex code: red, light blue, black, gray, purple, pink, navy, light gray, dark gray, and lavender.

Bars, areas, and pies use softer, less saturated versions of the same colors:

colorpalette #FF4D4D #C2E0F5 #5F5F5F #B1B1B1 #AF5FAF #FFDBEE ///
             #5D7A93 #D3D3D3 #909090 #E8E7F6, rows(5) ///
    title("cleanplots softer color palette for bars and area plots" ///
          "RGB and Hex codes shown")

The ten softer cleanplots colors used for bars and areas, as swatches labeled with RGB and hex codes.

For comparison, the cleanplots colors beside the colors of Stata’s current default scheme (stcolor, since Stata 18) and its previous default (s2color):

colorpalette, span n(10) : cleanplots / st / s2

Three rows of ten color swatches: the cleanplots palette, the stcolor palette, and the s2color palette.

Markers and line patterns

Along with its color, each series gets a marker symbol and a line pattern. The ten marker symbols and line patterns, drawn with the symbolpalette and linepalette commands:

symbolpalette smcircle_hollow smcircle smsquare_hollow smsquare smtriangle_hollow ///
    smtriangle smdiamond_hollow smdiamond plus plus, title("cleanplots marker symbols")
linepalette solid solid dash dash shortdash shortdash longdash longdash solid solid, ///
    title("cleanplots line patterns")

The ten cleanplots marker symbols, numbered 1 to 10: hollow circle, circle, hollow square, square, hollow triangle, triangle, hollow diamond, diamond, plus, and plus.

The ten cleanplots line patterns, numbered 1 to 10: solid, solid, dash, dash, short dash, short dash, long dash, long dash, solid, and solid.

The ten series as cleanplots draws them, with each series’ color, marker symbol, and line pattern together:

clear
set obs 4
Number of observations (_N) was 0, now 4.
generate x = _n
forvalues i = 1/10 {
    generate y`i' = `i'
}
twoway connected y1-y10 x, msize(vlarge ...) lwid(medthick ...) ///
    yscale(reverse range(0.5 10.5)) ylabel(1/10, nogrid) ytitle("Series") ///
    xscale(off) xlabel(, nogrid) legend(off) ///
    title("cleanplots colors, markers, and line patterns")

Ten horizontal lines, one per series, each drawn in its cleanplots color with its marker symbol and line pattern.

Color figures convert automatically to grayscale

One benefit of the cleanplots scheme is that you only need to create one set of figures: the colors and the markers, symbols, and lines that cleanplots uses can be printed in black and white or grayscale and still be easily distinguished. The palette alternates darker and lighter colors so that the first several groups differ in lightness alone, and every series also gets its own marker symbol and line pattern. The same palettes as above, in grayscale:

colorpalette, gscale span n(10) : cleanplots / st / s2

The same three palettes converted to grayscale; the cleanplots row alternates dark and light swatches while the other two rows have several swatches of similar gray.

A plot of predicted probabilities from an ordinal logit model, in color and as it prints in grayscale; the five outcome categories remain distinguishable by their line patterns and markers:

Predicted probabilities of five self-rated health categories across a count of obligatory roles, in color, with dashed confidence-interval lines.

The same plot converted to grayscale; the five lines are still told apart by their markers, line patterns, and shades of gray.

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 a figure. The cleanplots colors were selected because they are easily distinguishable across all types of colorblindness: there is no red-green pair, and the first five colors pass deuteranopia, protanopia, and tritanopia simulation checks. You can check the palette, or any set of colors, interactively at Coloring for Colorblindness.

Ordinal color palettes

The default cleanplots colors are nominal, with no implied ordering. For ordered categories, the ordinal cleanplots# schemes use colors that run from light to dark. Replace # with the number of ordered categories, from 2 to 15. cleanplots# uses the cividis palette, cleanplots#v uses the viridis palette, and adding r (cleanplots#r, cleanplots#vr) reverses the order of the colors. The four versions for five categories:

colorpalette, span : cleanplots5 / cleanplots5r / cleanplots5v / cleanplots5vr

Four rows of five swatches: cividis from light yellow to dark navy, cividis reversed, viridis from light yellow through green and blue to dark purple, and viridis reversed.

The Ordinal palettes page explains which version to use and shows them in bar charts, line graphs, and grayscale.

Version history

In October 2026, the ordinal schemes were expanded to every number of ordered categories from 2 to 15, in two palettes (cividis and viridis) and in both directions. If you installed cleanplots before then, run the installation line above again to get the new schemes.

In July 2026, cleanplots was given an update. For the primary palette, of most focus is the color choices for colors 6–10, which are now more colorblind friendly and more easily distinguishable. And, the intensity of colors now alternates for each odd and even aspect of the graph, aiding in black and white printing. In addition, the cleanplots# schemes now provide options for ordinal palettes. Finally, the legend is now due right of the graph, instead of in the bottom right.

I recommend using the most up to date version. But, if you are feeling nostalgic and want the original scheme, it is preserved as cleanplots_classic:

set scheme cleanplots_classic

Many of the features of cleanplots are adapted from the excellent black and white scheme plotplain (Bischof 2017).

R package version

A companion cleanplots package is available for R. It shares this scheme’s colors, marker symbols, line patterns, and layout for ggplot2. Read more about the R package at trentonmize.com/software/cleanplots_r.

References

Bischof, Daniel. 2017. “New Graphic Schemes for Stata: plotplain and plottig.” The Stata Journal 17(3): 748–759.

Nunez, Jamie R., Christopher R. Anderton, and Ryan S. Renslow. 2018. “Optimizing Colormaps with Consideration for Color Vision Deficiency to Enable Accurate Interpretation of Scientific Data.” PLOS ONE 13(7): e0199239.

van der Walt, Stéfan, and Nathaniel Smith. 2015. “Viridis: A Better Default Colormap for Matplotlib.” https://bids.github.io/colormap/

Back to top