ifs_pal <- function (type = "seq", palette = 1, direction = 1)
{
force(direction)
function(n) {
pal <- ifs.pal(n)
if (direction == -1) {
pal <- rev(pal)
}
pal
}
}
ifs.pal <- function(n) {
colours <- c("#184F3B", "#309E75", "#40646D", "#EB5C40", "#2478C7", "#F2B517", "#F7D374", "#8F3363", "#EED0E0")
colours[1:n]
}
scale_ifs2_fill <- function (..., type = "seq", palette = 1, direction = -1, aesthetics = "fill")
{
discrete_scale(aesthetics, "ifs", ifs_pal(type, palette,
direction), ...)
}
iris2 <- iris %>%
#mutate(x = 0.5, y = 0.5) %>%
group_by(Species) %>%
summarize(across(.cols = everything(), mean, na.rm = T)) %>%
melt(id = "Species")
y <- ggplot(iris2) +
geom_bar(aes(x = Species, y = value, fill = variable), stat = "identity") +
theme_ifs() +
scale_ifs2_fill()
y
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.