我有以下情节:
使用此代码生成:
library("GGally")
data(iris)
ggpairs(iris[, 1:4], lower=list(continuous="smooth", params=c(colour="blue")),
diag=list(continuous="bar", params=c(colour="blue")),
upper=list(params=list(corSize=6)), axisLabels='show')
我的问题是:
- 如何将相关线更改为
red
,现在是黑色的。
- 并且相关线隐藏在散点图下方。我想把它放在上面。我怎样才能做到这一点?
检查您的 GGally 版本packageVersion("GGally")
并将你的GGally升级到版本1.0.1
library("GGally")
library("ggplot2")
data(iris)
lowerFn <- function(data, mapping, method = "lm", ...) {
p <- ggplot(data = data, mapping = mapping) +
geom_point(colour = "blue") +
geom_smooth(method = method, color = "red", ...)
p
}
ggpairs(
iris[, 1:4], lower = list(continuous = wrap(lowerFn, method = "lm")),
diag = list(continuous = wrap("barDiag", colour = "blue")),
upper = list(continuous = wrap("cor", size = 10))
)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)