I have a vector z
like this
z <- as.numeric(as.factor(c(\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\")))
and for different d
Maybe something like this:
z <- LETTERS[1:7]
df <- list(
data.frame(ID=LETTERS[1:3],
LON=c(1,10,12),
LAT=c(1,14,13)),
data.frame(ID=LETTERS[3:5],
LON=c(2,11,18),
LAT=c(2,9,20))
)
layout(t(1:2))
for (i in 1:2){
plot(df[[i]]$LON, df[[i]]$LAT,
col = rainbow(length(z))[match(df[[i]]$ID,z)],
pch=16)
legend("topleft",
legend=z,
col=rainbow(length(z)),
pch=16)
}