cleanplots help file
To read the help file in Stata, type help cleanplots.
Title
cleanplots – Graphics scheme that implements best data visualization practices. Colors are color-blind friendly and remain distinguishable when printed in black and white, with coordinated marker symbols and line patterns so that groups stay distinct across multiple visual channels.
Overview
cleanplots changes the default look and feel of Stata graphics. The choices of colors, markers, line patterns, gridlines, legend placement, and other aspects of the figure follow best data visualization practices, with no per-graph effort needed.
The color palette is designed for accessibility. It contains no red-green pair (red-green color blindness is the most common form, affecting roughly 8% of men), and the first five colors pass simulation checks for all three major forms of color blindness. The palette also alternates darker and lighter colors so that the first several groups remain distinguishable by lightness alone when a figure is printed in black and white.
Color alone reliably distinguishes about 4-5 groups. Beyond that, additional markers or patterns are needed for distinguishability. cleanplots automatically varies markers, line patterns, and other features.
Bar charts, area plots, and pie charts automatically use softer versions of the colors. These elements use far more ink than points and lines, so full-strength colors overwhelm; cleanplots fades them for a cleaner look while full-strength colors remain on markers, lines, and outlines.
The default cleanplots colors are a nominal palette, meaning no ordering is implied by the colors or markers. For ordered categories, sequential cividis and viridis palettes are available with 2 through 15 colors, each with light-to-dark and dark-to-light versions (see Ordinal color schemes below).
For more information and to see examples, see the cleanplots website here.
Many of the features of cleanplots are adapted from the excellent black and white colorscheme plotplain.
Using cleanplots
To change your graphics scheme to cleanplots for all graphs:
set scheme cleanplots, permOr apply it to a single graph with the scheme() option:
sysuse auto, clear
graph twoway scatter price weight, scheme(cleanplots)Stata’s default graphic scheme is s2color. To change back to the default:
set scheme s2color, permThe colors
The ten main colors, used for markers, lines, and confidence intervals (shown as the Stata color definition and the resulting hex code):
| # | Definition | Hex | RGB |
|---|---|---|---|
| 1 | red*1.2 | #D50000 | 213 0 0 |
| 2 | eltblue*.9 | #8FC6EB | 143 198 235 |
| 3 | black | #000000 | 0 0 0 |
| 4 | gs9 | #909090 | 144 144 144 |
| 5 | purple*1.1 | #740074 | 116 0 116 |
| 6 | pink*.3 | #FFB3D9 | 255 179 217 |
| 7 | navy*1.3 | #143755 | 20 55 85 |
| 8 | gs12 | #C0C0C0 | 192 192 192 |
| 9 | gs4 | #404040 | 64 64 64 |
| 10 | lavender*.35 | #D9D7F0 | 217 215 240 |
Bars, areas, and pies use softer versions of the same colors (e.g., eltblue.7, purple.9), rendered with 70% intensity. You can verify any of the colors interactively at Coloring for Colorblindness.
Ordinal color schemes
The default cleanplots colors are nominal, with no implied ordering:
sysuse auto, clear
graph bar price, over(rep78) asyvars scheme(cleanplots)For ordered categories, the sequential ordinal schemes provide four choices for every number of colors from 2 through 15:
cleanplots# Cividis, light to dark (default)
cleanplots#r Cividis, reversed dark to light
cleanplots#v Viridis, light to dark
cleanplots#vr Viridis, reversed dark to light
Replace # with the number of ordered groups, from 2 through 15. For example, with five ordered categories:
sysuse auto, clear
graph bar price, over(rep78) asyvars scheme(cleanplots5)
graph bar price, over(rep78) asyvars scheme(cleanplots5r)
graph bar price, over(rep78) asyvars scheme(cleanplots5v)
graph bar price, over(rep78) asyvars scheme(cleanplots5vr)The default ordinal colors are from the cividis palette (Nunez, Anderton, & Renslow 2018), a variant of viridis (van der Walt & Smith 2015) optimized so that readers with red-green color blindness see essentially the same palette as everyone else. Because both palettes vary monotonically in lightness, the ordering itself also survives black and white printing.
Cividis runs between light yellow and dark navy and is recommended for maximum color-vision accessibility. Viridis runs between light yellow and dark purple, passing through green and blue; it uses more distinct hues. Both palettes are designed to be perceptually uniform and colorblind friendly.
The r suffix reverses only the sequence of colors; all other layout, legend, marker, and line-pattern settings remain unchanged. Stata does not have a general graph option to reverse a scheme’s colors.
The palettes are based on the R viridisLite palettes, sampled with end = .95. The default schemes run light to dark (direction = -1), while the reversed schemes run dark to light (direction = 1). The five originally released cividis schemes (3, 5, 7, 9, 11) retain their original RGB values.
The cleanplots# schemes inherit all layout, sizing, and legend settings from the main cleanplots scheme, and each series gets a distinct line pattern and marker symbol for maximum distinguishability. If a graph has more groups than the scheme has colors, the colors recycle (e.g., under cleanplots3 the 4th group repeats color 1) while the line patterns and marker symbols continue to vary, so recycled groups never share both color and pattern/symbol.
With many ordered categories, adjacent colors become increasingly difficult to distinguish. Labels or additional visual cues are recommended for such graphs.
The colors of the cleanplots and cleanplots_classic schemes, and of the ordinal schemes for 3, 4, 5, 6, 7, 9, and 15 categories, are also available by name in the colorpalette command, for example colorpalette cleanplots5v.
Updates
cleanplots was overhauled in July 2026 to ensure all 10 colors and the choices of lines, markers, etc. are color-blind friendly and work as well as possible in black and white. In addition, the ordinal cleanplots# schemes were added. Finally, the legend was moved to be at the direct right of the graph
I recommend using the updated scheme. But if you are feeling nostalgic, the older version is preserved as cleanplots_classic.
In October 2026, the ordinal schemes were expanded to include every number of colors from 2 through 15. Viridis palettes and reverse-order versions of both cividis and viridis were also added.
cleanplots for R
A companion cleanplots package for R (ggplot2) shares this scheme’s colors, marker symbols, line patterns, and layout. See the full documentation and details on downloading the R package at tdmize.github.io/cleanplots.
Citation & References
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/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 using the ordinal schemes, please also credit the corresponding color palette: Nunez et al. (2018) for cividis, or van der Walt and Smith (2015) for viridis.
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, Stefan, and Nathaniel Smith. 2015. “Viridis: A Better Default Colormap for Matplotlib.” https://bids.github.io/colormap/