Я не уверен, что это именно то, что вам нужно, но вы можете добавить новый вид под названием "total" к вашему Total_count
data.frame
. Используя предоставленные вами данные:
Данные
dput(Total_Count)
structure(list(Week = c(1L, 1L, 2L, 2L, 3L, 4L), Species = structure(c(1L, 2L, 2L, 3L, 3L, 4L), .Label = c("A", "B", "C", "D"), class = "factor"), Unit = c(13L, 24L, 15L, 32L, 43L, 32L)), row.names = c(NA, -6L), class = "data.frame")
dput(Total_Round)
structure(list(Week = c(1, 2, 3, 4), Unit = c(32, 55, 73, 62)), class = "data.frame", row.names = c(NA, -4L))
Код
Total_Round$Species <- factor(rep("Total",nrow(Total_Round))) # Create total species
df <- rbind(Total_Count, Total_Round) # Merge both data.frames
AllwithTotal_Species_Change<-ggplot(df, aes(x=Week, y=Unit, group=Species, color=Species)) +
geom_point()+
geom_line()+
scale_colour_manual(values = c("yellow", "orange 2",
"purple", "maroon 2",
"blue", "purple 4",
"green"))+
ylab("Total number of floral units over the four habitats")+
xlab("Sampling round")+
labs(col="Plant species")
AllwithTotal_Species_Change
Надеюсь, это поможет!