Hi,
I've written codes for editing the color and shape of some data points. However, the codes do not transfer to the scatterplot itself. What am I doing wrong?
elk <- structure(list(height = c(69.3, 69.3, 87.7, 99.8, 69.3, 84.1, 89.4, 91.9, 116.6, 104.7, 129.9, 94.6, 115.5, 138.4, 138.4, 127.5, 175.1, 164.3, 204.5, 183.6), antler = c(24.8, 34.5, 53.5, 58.3, 61.2, 67.3, 72.2, 81.5, 86.6, 91.4, 99.3, 101.5, 107.8, 115.7, 123.3, 128.5, 131.4, 162.6, 197.5, 239.1), species = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L, 1L, 2L), .Label = c("alces", "megaloceros", "unknown"), class ="factor")), class = "data.frame", row.names = c(NA, -20L))
elk$logy <- log(elk$antler)
elk$logx <- log(elk$height)
mdat <- data.frame(elk$points)
plot(elk$logx, elk$antler,
xlab="Log Shoulder height (cm)",
ylab="Log Antler length (cm)")
points(elk, mdat$sites, pch= c(16, 18, 22), col= c("red", "blue", "green3"))
legend("bottomright", legend=c("Unknown", "Alces", "Megaloceros"),
pch= c(16, 18, 22), col=c("red", "blue", "green3"))