Choosing between qplot() and ggplot() in ggplot2 [closed]

As for me, if both qplot and ggplot are available, the criterion depends on whether data is stored in data.frame or separate variables.

x<-1:10
y<-rnorm(10)

qplot(x,y, geom="line") # I will use this
ggplot(data.frame(x,y), aes(x,y)) + geom_line() # verbose

d <- data.frame(x, y)

qplot(x, y, data=d, geom="line") 
ggplot(d, aes(x,y)) + geom_line() # I will use this

Of course, more complex plots require ggplot(), and I usually store data in data.frame, so in my experience, I rarely use qplot.

And it sounds good to always use ggplot(). While qplot saves typing, you lose a lot of functionalities.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)