R gist — Plot an interactive 3D RGB colour space

Gist
Author

Stefano Coretta

Published

January 29, 2021

library(plotly)
codes <- seq(0, 255, 25.5)

rgb <- expand.grid(
  r = codes,
  g = codes,
  b = codes
) %>%
  mutate(colour = rgb(r, g, b, maxColorValue = 255))
rgb %>%
  plot_ly(x = ~r, y = ~g, z = ~b, marker = list(color = ~colour, size = 6))

Citation

BibTeX citation:
@online{coretta2021,
  author = {Coretta, Stefano},
  title = {R Gist — {Plot} an Interactive {3D} {RGB} Colour Space},
  date = {2021-01-29},
  url = {https://stefanocoretta.github.io/posts/2021-01-29-rgb-space/},
  langid = {en}
}
For attribution, please cite this work as:
Coretta, Stefano. 2021. R gist — Plot an interactive 3D RGB colour space. https://stefanocoretta.github.io/posts/2021-01-29-rgb-space/.