Skip to content
Prev 395189 / 398502 Next

annotate

Colleagues,

I wish to create y-data labels which meet a criterion.

Here is my reproducible code.
library(dplyr)
library(ggplot2)
library(cowplot)

above_92 <- filter(faithful,waiting>92)

ggplot(faithful,aes(x=eruptions,y=waiting))+
  geom_point(shape=21,size=3,fill="orange")+
  theme_cowplot()+
  geom_hline(yintercept = 92)+
  annotate(geom="text",x=above_92$eruptions,y=above_92$waiting+2,label=above_92$waiting)

A bit of trial and error is required to figure out what number to add or subtract to above_92$waiting.

Is there a more efficient way to do this?


Thomas Subia
Lean Six Sigma Senior Practitioner

DR?XLMAIER Group
DAA Draexlmaier Automotive of America LLC

mailto:thomas.subia at draexlmaier.com
http://www.draexlmaier.com

"Nous croyons en Dieu.
Tous les autres doivent apporter des donn?es.
Edward Deming


Public: All rights reserved. Distribution to third parties allowed.