【问题标题】:ggplot plot error in RR中的ggplot绘图错误
【发布时间】:2014-06-19 08:57:10
【问题描述】:

我正在尝试在我的数据中使用ggplot,但出现此错误:

##Don't know how to automatically pick scale for object of type function. Defaulting to continuous Error in data.frame(x = .Primitive("length"), fill = c(6L, 5L, 7L, 3L, : arguments imply differing number of rows: 0, 245

我正在尝试这个命令:ggplot(all, aes(length, fill = NLABfather)) + geom_density(alpha = 0.2)

改编自本主题How to plot two histograms together in R?(已选)

我的all 数据框如下所示:

value NLABfather
0.13 NE001362 0.17 NE001361 0.05 NE001378 -0.12 NE001359 -0.14 NE001379 0.13 NE001380 -0.46 NE001379 -0.46 NE001359 -0.68 NE001394 0.28 NE001391 0.84 NE001394 -0.43 NE001393 -0.18 NE001707 -0.47 NE001380 0.10 NE001362 -0.10 NE001381 0.08 NE001711 -1.15 NE001707 0.07 NE003322 -0.12 NE001394 0.19 NE001358 -0.61 NE001360 -0.12 NE001362 0.07 NE001394 0.10 NE001386 -0.53 NE001380 0.05 NE001380 -0.43 NE001362 -0.10 NE001395 -0.20 NE001389

干杯!

【问题讨论】:

    标签: r syntax plot ggplot2


    【解决方案1】:

    您的数据框列名为 value,但您已将 length 放入函数调用中。

     ggplot(all, aes(value, fill = NLABfather)) + geom_density(alpha = 0.2)
    

    生产一些东西。

    【讨论】:

      猜你喜欢
      • 2015-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-31
      • 2016-07-20
      相关资源
      最近更新 更多