2

Consider the following:

df <- data.frame(a=1:10,b=2:11)
ggplot(df,aes(x=a,y=b)) + geom_point()+geom_text(aes(label=a,x=a+0.1))

This works.

However for some reason the following doesn't work:

plotGG <- function(data,shift) {
  ggplot(data,aes(x=a,y=b)) + geom_point()+geom_text(aes(label=a,x=a+shift))
}
plotGG(df,.1)

Any clues??

Shambho
  • 3,250
  • 1
  • 24
  • 37

0 Answers0