ggplot2"不知道如何自动为非常类型的对象选择比例。"

时间:2015-09-18 09:13:30

标签: r ggplot2

service mysqld start

错误讯息:

mysqlbinlogmove --binlog-dir=/server/data /new/binlog_dir

添加完整代码:

我的xlsx文件:

Name    Passage growth
P1.X.1  1   42036
P1.X.1  2   42036
P1.X.1  3   42036
P1.X.2  1   42036
P1.X.2  2   42036
P1.X.2  3   42036
P1.X.3  1   42036
P1.X.3  2   42036
P1.X.3  3   42036
P1.X.4  1   42036
P1.X.4  2   42036
P1.X.4  3   42036
P1.X.1  1   42036
P1.X.1  2   42036
P1.X.1  3   42036
P1.X.2  1   42036
P1.X.2  2   42036
P1.X.2  3   42036
P1.X.3  1   42036
P1.X.3  2   42036
P1.X.3  3   42036
P1.X.4  1   42036
P1.X.4  2   42036
P1.X.4  3   42036

P.Plot <- qplot(aes(y = as.numeric(D.Subset$growth)), 
    data = D.Subset, x = as.numeric(D.Subset$Passage), 
    main = D.Subset$Name, geom = "line", facets = Name ~ .)

我的scrpit:

"Don't know how to automatically pick scale for object of type uneval. Defaulting to continuous
Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : 
  cannot coerce class ""uneval"" to a data.frame"

有没有人有解决方案?

1 个答案:

答案 0 :(得分:4)

如果你查看qplot的帮助,你会发现qplot不接受aes。

所以你可以用ggplot构建情节:

P.Plot1 <- ggplot(D.Subset, 
                 aes(x=Passage,y=growth)) + 
                geom_line() +
                facet_grid(Name~.)

或者从调用qplot中删除aes:

P.Plot2 <- qplot(data = D.Subset, 
                y = growth, 
                x = Passage, geom = "line", facets = Name ~ .)

请注意,对于这两种解决方案,您已经指定了数据帧。因此,您可以只使用列名称,而不需要D.Subset$growth。在绘图之前将数据转换为数字(如果有必要)可能是更好的做法。

两者都导致: enter image description here