jz_
jz_

Reputation: 358

r gplot themes -- I would like to determine colors used

This seems like an easy question, but I cannot find the answer.

I am using the theme_fivethirtyeight theme to do a three factor scatterplot. In ggplot2, if that makes a difference. (Although the issue would be for any theme.) I would like to capture the three colors that are used in the theme for use elsewhere. How can I extract them from the theme?

I have seen the follow suggested:

library(ggthemes)
ggthemes_data$fivethirtyeight

But the colors listed do not seem to correspond to the graph.

Upvotes: 0

Views: 45

Answers (1)

L_W
L_W

Reputation: 1002

Here's how you can get the hex codes of the colors: (the codes are the same that you get from the command you posted though)

library("scales")
library("ggthemes")
show_col(fivethirtyeight_pal()(3))

enter image description here

Upvotes: 3

Related Questions