Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identify points in Scatterplot (qplot)

Tags:

r

ggplot2

Is there a way to identify (means: show the observation number) some points in a Scatterplot (using qplot()) such as identify does for plot()?

Best regards, Sarah

like image 717
Sarah Avatar asked May 24 '26 16:05

Sarah


1 Answers

Try this modified from the link I provided above

dat <- data.frame(x = rnorm(10), y = rnorm(10), label = seq(1:10))
ggplot(dat, aes(x,y)) + geom_point() +
  geom_text(data = dat, aes(x,y, label = label), hjust = 2)
like image 151
Mark Miller Avatar answered May 26 '26 07:05

Mark Miller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!