README.md

DataRobotColors

The goal of DataRobotColors is to allow users to bring the DataRobot color schemes in to R plots and specifically {ggplo2}. The main functions of this package are scale_color_DataRobot() and scale_fill_DataRobot(). Additionally, the DataRobot_pal() function returns a pal function that can be used in other R plotting functions. Helper functions include DataRobot_palette_names() to name the palettes available, and DataRobot_get_palettes() to return the hex values of the underlying palette.

Palettes include:

Installation

You can install the development version of DataRobotColors from GitHub with:

# install.packages("devtools")
devtools::install_github("mrecos/DataRobotColors")

DataRobot Palettes

Blues, Reds, and Grays palette

Diverging and Qualitateive palette

{ggplot2} Examples

library(DataRobotColors)
library(ggplot2)
theme_set(theme_minimal())
# Default is `DR_Blues`
ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
  geom_point(size = 4) +
  scale_color_DataRobot()

ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
  geom_point(size = 4) +
  scale_color_DataRobot(palette = "DR_Reds")

ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Sepal.Length)) +
  geom_point(size = 4, alpha = .6) +
  scale_color_DataRobot(discrete = FALSE, palette = "DR_Grays")

ggplot(mpg, aes(manufacturer, fill = manufacturer)) +
  geom_bar() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  scale_fill_DataRobot(palette = "DR_Diverging", guide = "none")

ggplot(mpg, aes(reorder(manufacturer, -cty), 
                y = cty, fill = manufacturer)) +
  geom_boxplot() +
  labs(x = "Manufacturer") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  scale_fill_DataRobot(palette = "DR_Qualitative", guide = "none")

ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
  geom_point(size = 4) +
  scale_color_DataRobot(palette = "DR_Qualitative")

R Base plot Examples

library(DataRobotColors)
new_DR_Reds_pal <- DataRobot_pal("DR_Reds")
new_DR_Diverging_pal <- DataRobot_pal("DR_Diverging")
par(mfrow = c(1, 2))
image(volcano, 
      col = new_DR_Reds_pal(16), 
      main = "DR_Reds palette")
image(volcano, 
      col = new_DR_Diverging_pal(16), 
      main = "DR_Diverging palette")

Leaflet Examples (TBD)



mrecos/DataRobotColors documentation built on March 19, 2022, 7:12 a.m.