*! version 1.0 March 2022

Title

color_style -- Module to change colors in your scheme file.

Syntax

color_style [palette], [graph list] [n(#) colorpalette options]

options

palette Specifies a particular palette to be applied to the Scheme file. One can use
any of the palettes or color options following colorpalette syntax, or the palettes provided along with this command.
See list.

graph When requested, the command will display the palette of colors one will apply.

list Provides a list of Palettes that accompany this file. These are in addition to the ones in colorpalette.

list(letter) Provides a list of Palettes that start with "letter".

n(#) Defines the number of colors to be used for the palette. n(#) should be between 1 to 15. If you select a number larger than 15, those colors will not be used in the scheme file. If n(#)<15, unused pstyle's will be recycled.

ipolate(#) Same as with n(#). However, using n(#) does not work under Stata versions earlier than 14.2.

The default is to use the number of colors in the palette. For exaple Greek has 5 default colors. Using and n(#) higher or lower than this will interpolate colors. See the options in colorpalette.

showcase This will show you how the palette will look for up to 15 colors.

Extra:

font_style font

This has 1 job. Change the fontface for your graphs.

graphquery options

This has 1 job. Returns the scheme properties associated to a particular option.

For example "graphquery color p1" should provide the color assigned to color p1 (navy for s2color).

Description

This module aims to provide an easy way to change the palette colors in your scheme and graphs.

This command works as a wrapper on top of Ben Jann's colorpalette and grstyle. Whereas the palette's
were put together by Blake Robert Mills, Karthik Ram and Jake Lawlor.

Because this command works as a wrapper for colorpalette, you can easily use your own palettes, or the ones in colorspace to make your graphs shine.

Examples

Lets start by loading some data:

. use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta

. set scheme white

Say that you are considering using one of the color palettes that comes with this command.
However, you do not know what is available, so you start by simply typing:

. color_style , list

Now, assume you want decide for the enigmatic Egypt, but are unsure about the colors,
then you can type:

. color_style egypt, graph

What you will see is that this palette uses 4 colors. So only the first 4 Styles would be modified.
You could extend this palette to 15 colors:

. color_style egypt, graph n(15)

You may or may not like this set of colors interpolated. Alternatively, you can choose to recycle the colors,
using option class(). This is a colorpalette option:

. color_style egypt, graph n(15) class(q)

So, lets settle with the option above, and now make a simple scatter plot

. xtile q4=exper, n(4)

. separate lnwage,by(q4)

. scatter lnwage? exper

But of course, we can change this with any other palette:

. color_style peru1

. scatter lnwage? exper

. color_style peru2

. scatter lnwage? exper

. color_style johnson

. scatter lnwage? exper

. graph bar lnwage?, stack

. color_style viridis, n(5)

. scatter lnwage? exper

. graph bar lnwage?, stack

Finally, if you are interested looking at how many of the palettes look with , scatterplots, violinplots,
or stream plots, you can look here: https://github.com/friosavila/playingwithstata/blob/gh-pages/articles/palette.md

Aknowledgement

This command could not have been possible without the work by Ben Jann, who make it possible to easily manipulate colors in Stata using colorpalette, as well as his work with grstyle, which make it quite easy to manipulate schemes.

Furthermore, thank you to Blake Robert Mills, Karthik Ram and Jake Lawlor, who put together very amazing palettes.

Author

Fernando Rios-Avila

Levy Economics Institute of Bard College

Blithewood-Bard College

Annandale-on-Hudson, NY

friosavi@levy.org

Also see

Help: colorpalette, grstyle