I've made a GIF of a series of plots (scatterplots), which display points of latitude and longitude from year to year showing species distribution and population distribution. However, in some years, there are no values for some species (ie. no individuals were collected in that year). This creates a problem in a GIF, because the legends should be constant from plot to plot.
I want to be able to manually include or insert these missing species in the legend, with the species names and colour values accordingly (even if they are not in the plot shown).
Reproducible example (although I don't know if it's necessary):
#Creating mock longitude and latitude poitns
a <- c("1","1")
b <- c("2","2")
c <- c("3","1")
d <- c("2","1")
e <- c("2","3")
f <- c("3","3")
x <- rbind(a,b,c,d,e,f)
#Assigning species to each observation.
sp <- c("sp1", "sp1", "sp1", "sp1", "sp1", "sp2")
year <- c(2000, 2000, 2000, 1999, 1999, 1999)
x2 <- cbind(x, sp, year)
df <- as.data.frame(x2)
#Subset the df by year, which I have to do in my original dataset.
df99 <- subset(df, year==1999)
df00 <- subset(df, year==2000)
g1999 <- ggplot(data=df99, aes(V1, V2, colour=sp)) + geom_point()
g2000 <- ggplot(data=df00, aes(V1, V2, colour=sp)) + geom_point()
In this case, I would like to show on the plot legend, the label and colour for both Sp1 and Sp2.
Any help is greatly appreciated!