Graphics error: Don't know how to automatically pick scale

Viewed 16931

When I am trying to use ggplot to create a plot of relationship of nycflights13, it shows following error, could someone help me to figure it out?

library(ggplot2)
library(nycflights13)

data=flights

mutate(data,
   delay=arr_delay - dep_delay)

p1 <- ggplot(data,aes(x=dist,y=delay))+
      geom_point(aes(color=count,size=count),alpha=1/2)+
      xlab("Distance")+
      ylab("delay")+
      ggtitle("Distance vs. Delay")+
      geom_smooth()+
      scale_size_area()

p1

Error:

Don't know how to automatically pick scale for object of type function. 
Defaulting to continuous.

Don't know how to automatically pick scale for the object of type function. 
Defaulting to continuous.

Don't know how to automatically pick scale for object of type tbl_df/tbl/data.frame. Defaulting to continuous.

Error: Aesthetics must be either length 1 or the same as the data (336776): colour, size, x, y
2 Answers
Related