I have been trying to identify extreme values in a R ggplot2
.
Is there any way to have a plot where besides the point (or instead of it) representing the values, it also shows the index? Or any other thing that allows you to quickly identify it?
The closest thing I found was with the identify()
function, but it didn't work very well for me.
Any recommendations?
I'll give a basic ggplot plot:
df = data.frame(x = runif(10,0,1), y = runif(10,0,1))
ggplot(df, aes(x,y)) +
geom_point(col="red") + theme_bw()
Update:
I've been trying new things. I finally got exactly what I wanted.
df = data.frame(x = runif(10,0,1), y = runif(10,0,1))
ggplot(df, aes(x,y, label = rownames(df))) +
geom_point() + geom_text() + theme_bw()
Now I can easily identify the values that I want. Hope it helps other people that are new to ggplot
.
If anyone knows ways to improve it, feel free to do so.