-2

Hello I would like to basically exactly what this post does R- plot numbers instead of points but in ggplot.

I have a dataframe. I want to plot x and y. Easy. I also have a third column of ID's for all the points. I would like to plot these ID'S from this third column instead of regular points. The IDs are numbers from 1-300.

Monal
  • 127
  • 1
  • 6
  • 1
    Please refer to [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Nathan Werth Aug 22 '17 at 20:36

1 Answers1

13

Try this:

dat <- data.frame(x=rnorm(300), y=rnorm(300), ID=1:300)

ggplot(dat, aes(x= x, y= y)) +geom_text(aes(label=ID))

There are overlapping points and so the IDs overlap on one or the other points.

enter image description here

Prradep
  • 5,506
  • 5
  • 43
  • 84