# Doing some test cases
library(tidyverse)
library(reshape2)
# Check how singleplot works - conclusion: they don't
iris1 <- iris %>%
filter(Species == "setosa") %>%
mutate(mean_length = mean(Sepal.Length, na.rm = T))
x <- ggplot(iris1) +
geom_bar(aes(x = Species, y = mean_length), stat = "identity") +
scale_fill_ifs()
# check scale_fill manual worls
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_fill_ifs()
y <- ggplot(iris2) +
geom_bar(aes(x = Species, y = value, fill = variable), stat = "identity") +
theme_ifs() +
scale_fill_ifs(values = c("mid_green", "mid_blue", "mid_red", "mid_yellow"))
# check ggsave
ggsave_ifs("test_graph1.png", y, path = "tests/", height = 400, width = 400)
ggsave_ifs("test_graph1.png", y, path = "tests/", height = 10, width = 10, units = "in")
ggsave_ifs("test_graph1.png", y, path = "tests/", save_data = T)
# check big facet wrap
y2 <- ggplot(iris2) +
geom_bar(aes(x = Species, y = value, fill = variable), stat = "identity") +
theme_ifs() +
facet_wrap(~Species, ncol = 1) +
scale_fill_ifs(values = c("mid_green", "mid_blue", "mid_red", "mid_yellow"))
ggsave_ifs("test_graph_facet.png", y2, path = "tests/")
# check scale colour ifs works
# checking gradient works
ggplot(iris) +
geom_point(aes(x = Sepal.Length, y = Sepal.Width, col = Petal.Length), stat = "identity") +
theme_ifs() +
scale_colour_ifs(values = c("dark_green_2", "mid_yellow"), gradient = T)
mtcars2 <- mtcars
ggplot(mtcars) +
geom_point(aes(x = mpg, y = wt, col = factor(cyl))) +
scale_colour_ifs()
data("economics")
economics2 <- economics %>%
select(date, psavert, uempmed) %>%
melt(id = "date")
ggplot(economics2) +
geom_line(aes(x = date, y = value, col = variable)) +
theme_ifs() +
scale_colour_ifs(values = c("mid_purple", "mid_red"))
# checking error message works
ggplot(economics2) +
geom_line(aes(x = date, y = value, col = variable)) +
theme_ifs() +
scale_colour_ifs(values = c("mid_purple", "blorb"))
ggplot(economics2) +
geom_line(aes(x = date, y = value, col = variable)) +
theme_ifs() +
scale_colour_ifs(values = c("mid_purple", "mid_green", "mid_red"))
# Checking actual colours
ggplot(iris) +
geom_point(aes(x = Sepal.Length, y = Sepal.Width, col = Petal.Length), stat = "identity") +
theme_ifs() +
scale_colour_ifs(values = c("dark_green_2", "mid_yellow"), gradient = T)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.