【问题标题】:ggplot2 doesn't know how to deal with data of class unevalggplot2 不知道如何处理 uneval 类的数据
【发布时间】:2016-10-19 12:57:34
【问题描述】:

我知道有一些帖子 s 到这个主题。但他们没有帮助我。我只使用了一个数据集,但还是会出现这个错误。

ggplot2 doesn't know how to deal with data of class uneval

wellmixed<-read.table("param_analysis_Spatial.txt",skip=1)
wellmixed[is.na(wellmixed)] <- 0

wellmixed %>%
       group_by(V2) %>%
       arrange(V1) %>%
       mutate(ymin = (V1 + lag(V1))/2
            , ymax = (V1 + lead(V1))/2
            , xmin = V2 - 0.005
            , xmax = V2 + 0.005
            , ymin = ifelse(is.na(ymin), 0, ymin)
            , ymax = ifelse(is.na(ymax), 0.16, ymax)
                   ) %>%

  +     ggplot(aes(xmin = xmin
                 , xmax = xmax
                 , ymin = ymin
                 , ymax = ymax
                 , fill = V7)) +
       geom_rect(data=wellmixed)

是不是因为%>%?

【问题讨论】:

  • 为什么ggplot前面有一个+

标签: r ggplot2


【解决方案1】:

当 ggplot() 中的第一个参数不是 data.frame 时,您会收到 ggplot2 doesn't know how to deal with data of class uneval 消息。

如果 ggplot() 中的第一个参数是你的审美,那么你需要写:

   ggplot(mapping = aes(...your aesthetics...) ) 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-06
    • 2013-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-21
    相关资源
    最近更新 更多