Error: (converted from warning) Ignoring unknown aesthetics

前端 未结 1 446
囚心锁ツ
囚心锁ツ 2021-01-26 07:56

Sometimes when I use ggplot2 I get following error:

> dframe <- data.frame(a=letters, b=LETTERS, x=runif(26), y=runif(26))
> p <- ggplot         


        
1条回答
  •  梦毁少年i
    2021-01-26 08:52

    Place the aesthetic mapping under ggplot instead of geom_point to avoid the warning:

    ## This produces an "unknown aesthetic" warning
    ggplot( mtcars, aes( x = wt, y = mpg ) ) + geom_point( aes( text = cyl ) )
    
    ## This doesn't
    ggplot( mtcars, aes( x = wt, y = mpg, text = cyl ) ) + geom_point()
    

    0 讨论(0)
提交回复
热议问题