I´m creating a spatial map of trees based on x-y location using the spatstat package and the ppp function. I´ve been able to do this and the size of each point is based on tree diameter. What I haven´t been able to do, and I hope to find some help here, is to create a legend that allows me to show these different circles and also include the 6 tree species within the plot. Here is the code I´m using:
df <- subset(plots, plots$spp == "DF") # Douglas-fir
dfx <- as.numeric(as.character(df$x))
dfy <- as.numeric(as.character(df$y))
dfd <- as.numeric(as.character(df$d))
dfp <- ppp(dfx, dfy, window = owin(c(0, 100), c(0, 100)),
unitname=c("metres","metres"), marks = dfd)
par(mar = c(2, 2, 2, 2))
plot(dfp, main = "", cex = 0.8, markscale = 0.04,
bg = rgb(0.1,0.9,0.3,0.5), fg = "black")
I have a similar structure for every species in the plot (wh for Western Hemlock and the code is the same...)
Thanks!