R中的ggplot绘图错误

时间:2014-05-02 15:50:59

标签: r syntax plot ggplot2

我尝试在我的数据中使用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?(选择aswer)

我的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

干杯!

1 个答案:

答案 0 :(得分:2)

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

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

产生一些东西。

相关问题