library(dplyr)
library(ggplot2)
library(tintin)
total_head_trauma <- tintin_head_trauma %>%
arrange(-loss_of_consciousness_length) %>%
filter(row_number() <= 5)
# discrete scale
ggplot(total_head_trauma) +
geom_col(aes(x = cause_of_injury, y = loss_of_consciousness_length,
fill = book_title), position = "dodge") +
labs(x = "Cause of injury", y = "Loss of consciousness length",
title = "Top five causes of injury") +
theme_minimal() +
scale_fill_tintin_d(option = "cigars_of_the_pharaoh", direction = -1) +
coord_flip()
# continuous scale
# continuous scale
ggplot(total_head_trauma) +
geom_col(aes(
x = cause_of_injury, y = loss_of_consciousness_length,
fill = year
), position = "dodge") +
labs(
x = "Cause of injury", y = "Loss of consciousness length",
title = "Top five causes of injury"
) +
theme_minimal() +
scale_fill_tintin_c(option = "cigars_of_the_pharaoh", direction = -1)
Run the code above in your browser using DataLab