Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bb_colors_manual

Set colors for each datas


Description

Set colors for each datas

Usage

bb_colors_manual(bb, ..., opacity = 1)

Arguments

bb

A billboard htmlwidget object.

...

A named list, where names correspond to the data, and values to color associate with it.

opacity

Color opacity (for area charts).

Value

A billboard htmlwidget object.

Examples

library("RColorBrewer")

# Scatter
billboarder() %>% 
  bb_scatterplot(
   data = iris, 
   x = "Sepal.Length", 
   y = "Sepal.Width", 
   group = "Species"
  ) %>% 
  bb_axis(x = list(tick = list(fit = FALSE))) %>% 
  bb_point(r = 8) %>% 
  bb_colors_manual(
   setosa = "#440154", 
   virginica = "#21908C", 
   versicolor = "#FDE725"
  )

# Pie
stars <- data.frame(
  package = c("billboarder", "ggiraph", "officer",
              "shinyWidgets", "visNetwork"),
  stars = c(9, 177, 43, 44, 169)
)
cols <- brewer.pal(n = 5, name = "Dark2")

billboarder() %>% 
  bb_piechart(data = stars) %>% 
  bb_colors_manual(
   setNames(as.list(cols), stars$package) # this is a named list
  )

billboarder

Create Interactive Chart with the JavaScript 'Billboard' Library

v0.3.1
MIT + file LICENSE
Authors
Victor Perrier [aut, cre], Fanny Meyer [aut], NAVER Corp [cph] (billboard.js library), Mike Bostock [cph] (d3.format library)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.