View source: R/color_palette.R
color_palette | R Documentation |
A standardized color palette to be used for all plots within the NEST project.
color_palette(n = 10, palette = "nest")
n |
(
|
palette |
(
|
A list of hex color code
library(grid)
plot_pal <- function(x) {
grid.newpage()
pushViewport(plotViewport(rep(1, 4)))
pushViewport(viewport(layout = grid.layout(1, ncol = length(x))))
for (i in seq_along(x)) {
grid.rect(
gp = gpar(fill = x[i], col = NA),
vp = viewport(layout.pos.col = i, layout.pos.row = 1)
)
}
}
plot_pal(color_palette(n = 10, palette = "nest"))
plot_pal(color_palette(n = 10, palette = "stream"))
plot_pal(color_palette(n = 10, palette = "viridis"))
plot_pal(color_palette(n = 10, palette = "accessible"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.