How to make geom_text plot within the canvas’s bounds

ggplot 2.0.0 introduced new options for hjust and vjust for geom_text() that may help with clipping, especially "inward". We could do:

ggplot(data=df, aes(x=n.wheels, y=utility, label=word))  + 
  geom_text(vjust="inward",hjust="inward")

enter image description here

Leave a Comment