Dataframe(从here借来):
df.test <- data.frame(id = rep(1:6, each = 50), x = rnorm(50*6, mean = 10, sd = 5),
y = rnorm(50*6, mean = 20, sd = 10),
z = rnorm(50*6, mean = 30, sd = 15))
情节:
library(ggplot2)
ggplot(df.test, aes(x)) + geom_histogram() + facet_wrap(~id)
请求帮助:我想在每个方面上叠加整个数据的直方图,以便立即比较每个方面与总数据集,如果可能的话,我希望整个数据集显示为freq_poly():
ggplot(df.test, aes(x)) + geom_freqpoly()