Making geom_point() aesthetic literally be the name of a factor

Hello,
I have some data displayed on a boxplot with geom_point(). Each corresponds to numbered replicates 1-18. I would like to replace the shape of those points with the actual number of the replicate, i.e. instead of a point I want it to display a number like "3".

boxplot <- ggplot(df)+
  geom_boxplot(aes(x=data1,y=data2))+
                geom_point(aes(x=data1,y=data2))+ #This is the one I want to change
                 theme_classic()

Thanks for any advice you can offer.

You can use geom_text. I don't have your data, but this should work:

boxplot <- ggplot(df)+
  geom_boxplot(aes(x=data1,y=data2))+
                geom_text(aes(label = id))+ # Replace `id` with name of actual column
                 theme_classic()
1 Like

Awesome, I had no idea that was an option. Much appreciated.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.