I have the following code to create the attached plot, essentially I want to show the abundances from May - September. But there are no abundances in May, August and September. Is there a way I can include those month in my plot even though there is no data for those months in my data frame?
coef <- 625
HerringJCO <- JCOHattacksnoduplicates %>%
mutate(month = as.factor(month),
herringmean = herringmean/coef) %>%
pivot_longer(cols = c("herringmean","jcoaverage"), names_to = "species",
values_to = "mean") %>%
ggplot(aes(x = month, group = species)) +
geom_bar(aes(y = mean, fill = species), stat = "identity", position =
"dodge") +
geom_line(aes(y = attacksum, group = 1)) +
geom_point(aes(y = attacksum)) +
geom_line(aes(y = passivesum, group = 1), color = "green") +
geom_point(aes(y = passivesum), color = "green") +
scale_y_continuous(expand = c(0,0), limits = c(0,35), sec.axis =
sec_axis(~.*coef, name = "Average Herring Abundance")) +
ylab("Average Salmon Abundance and Sum of attacks") +
xlab("") +
theme_classic() +
theme(axis.text.x = element_text(size = "14")) +
scale_x_discrete(labels=c("4"="April", "5" = "May", "6" = "Jun", "7" =
"Jul", [![enter image description here][1]][1]"8" = "Aug", "9" = "Sept", "10" = "Oct")) +
HerringJCO