I'm not sure if this is what you want but you can add a new species called "total" to your Total_count
data.frame
.
(我不确定这是否是您想要的,但是您可以在Total_count
data.frame
添加一个名为“ total”的新种类。)
Using the data you provided: (使用您提供的数据:)
Data
数据)
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))
Code
码)
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
Hope this helps!
(希望这可以帮助!)