【发布时间】:2016-02-17 23:05:06
【问题描述】:
我想要一个带有两个图的图形,其中一个是 ggplot2 对象,第二个是使用 gplots 生成的图。例如将接下来的两个图连续组合起来:
library(ggplot2)
library(gplots) #For plotmeans
df = structure(list(age = c(14, 22, 35, 21, 88, 66, 14, 22, 35, 21),
values = c(22, 8, 1.9, 26.8, 32, 15.,1.9, 26.8, 32, 15.)),
.Names = c("age", "values"),
row.names = 1:10,
class = "data.frame")
ggplot(df, aes(values)) + geom_histogram()
plotmeans(df$values ~ df$age)
我尝试了grid、gridExtra、par 和 layout,但没有成功。
知道我该怎么做吗?
【问题讨论】:
-
请始终添加可重现的示例。 stackoverflow.com/questions/5963269/…
-
给你,但没关系