st <- "Amount of penguins in the Palmer Penguins library dataset"
ggplot(data = plot_data) +
geom_segment(mapping = aes(x = 0,
xend = n,
y = species,
yend= species),
colour = "#f4f7f7",
size = 1) +
geom_image(mapping = aes(x = n,
y = species,
#image = paste0("posts/2023-01-25-ggimage/images/", species, ".png")),
image = paste0("images/", species, ".png")),
asp = 2,
size = 0.12,
image_fun = border) +
geom_text(mapping = aes(x = n + 16,
y = species,
label = species),
size = 9,
hjust = 0,
family = "roboto",
colour = "#f4f7f7") +
scale_y_discrete(limits = rev) +
scale_x_continuous(breaks = c(0, 50, 100, 150),
limits = c(-5, 250),
expand = c(0, 0)) +
labs(title = "PALMER PENGUINS",
subtitle = str_wrap(st, 70),
x = NULL,
y = NULL) +
theme(axis.text = element_text(family = "roboto",
size = 24,
lineheight = 0.4,
colour = "#f4f7f7"),
axis.text.y = element_blank(),
axis.title = element_text(family = "roboto",
size = 24,
lineheight = 0.4,
margin = margin(t = 10),
colour = "#f4f7f7"),
axis.ticks = element_blank(),
plot.subtitle = element_text(family = "roboto",
size = 18,
hjust = 0.5,
lineheight = 0.4,
margin = margin(b = 10),
colour = "#f4f7f7"),
plot.title = element_text(family = "cinzel",
size = 44,
hjust = 0.5,
margin = margin(b = 10),
colour = "#f4f7f7"),
plot.margin = margin(10, 10, 10, 10),
panel.grid.minor = element_blank(),
panel.grid.major.y = element_blank(),
plot.title.position = "plot",
panel.grid.major.x = element_line(linetype = "dashed",
colour = alpha("#bb8899", 0.3)),
plot.background = element_rect(fill = "#203d58", colour = "#203d58"),
panel.background = element_rect(fill = "#203d58", colour = "#203d58"))