我正在尝试使用ggplot2
绘制堆积面积图。
我的数据框具有以下形式:
id <- "1lDyf1H-rrW4qPchXfRFnTt8kFMzmuDrp"
Weights <- read.csv(sprintf("https://docs.google.com/uc?id=%s&export=download", id))
Weights <- Filter(function(x)!all(is.na(x)), Weights)
Weights <- Weights[1:nrow(Weights) - 1,]
此刻我的代码如下:
X_Axis <- Weights[1]
Y_Axis <- Weights[,2:12]
Group <- colnames(Weights)[2:12]
ggplot(Weights, aes(x=X_Axis, y=Y_Axis, fill=Group)) +
geom_area()
但是我收到以下错误
Error: Aesthetics must be either length 1 or the same as the data (101): y, fill
如何在堆积面积图中绘制它们?