I would like to make Whole face_wrap graphs with min and max values coloured. But when I ran the code below it only colour the min/max for all graph not individually.
ggplot(data = df, aes(
x = factor(day_of_week,
levels =
c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
),
y = total_total_intensity
)) +
geom_bar(stat = "sum") +
geom_bar(
data = subset(df, total_total_intensity == min(total_total_intensity)),
aes(day_of_week, total_total_intensity),
fill = "red", stat = "sum"
) +
geom_bar(
data = subset(df, total_total_intensity == max(total_total_intensity)),
aes(day_of_week, total_total_intensity),
fill = "green", stat = "sum"
) +
facet_wrap(~time_of_day) +
theme(axis.text.x = element_text(angle = 45)) +
labs(
title = "Daily Activity Per Daytime", x = "Day of the week",
y = "Total Intensity", subtitle = "Whole week"
)
How can I highlight the min/max individually for this code?