I have successfully made a scatterplot, with different symbols for each data series. But what I want to do is make the same scatterplot with the point to show up as numbers. Not the value of each point, just an assigned number.
As of right now, I have three depths I am plotting (0, 3, 6cm). I have all my 0cm as triangles, etc. I want my 0cm points to be the character 0, the 3cm points to show up as 3, and the 6cm points to show up as 6.
Is this possible?
Sure, just pass the pch
parameter as a character.
dat <- data.frame(x=rnorm(100), y1=rnorm(100)-1, y2=rnorm(100), y3=rnorm(100)+1)
plot(y1 ~ x, data=dat, pch="0", ylim=c(-4, 4))
points(y2 ~ x, data=dat, pch="3")
points(y3 ~ x, data=dat, pch="6")
ETA: one nice thing is that the pch
parameter, like many base graphics parameters, is vectorised. So you can do something like this (which also works for Agstudy's answer).
dat <- data.frame(x=rnorm(300), y=rnorm(300) + c(0,3,6), depth=rep(c(0,3,6), 100))
plot(x ~ y, data=dat, pch=as.character(dat$depth))