我正在做 ggpairs 图,但回归线太粗,并且“Corr:”文本字体太大。
data(mtcars)
head(mtcars)
mtcars$am <- as.factor(mtcars$am)
g <- ggpairs(
data = mtcars,
lower = list(
continuous = wrap("smooth", alpha = 0.3, color = "blue")
)
)
g <- g + theme(
axis.text = element_text(size = 6),
axis.title = element_text(size = 6),
legend.background = element_rect(fill = "white"),
panel.grid.major = element_line(colour = NA),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "grey95")
)
print(g, bottomHeightProportion = 0.5, leftWidthProportion = .5)
Run Code Online (Sandbox Code Playgroud)
这是输出:
我在GGally文档中找不到可以设置它的地方。
有什么指点吗?
尝试增加字体大小:
data(mtcars)
head(mtcars)
mtcars$am <- as.factor(mtcars$am)
library(ggplot2)
library(GGally)
lowerFn <- function(data, mapping, ...) {
p <- ggplot(data = data, mapping = mapping) +
geom_point(color = 'blue', alpha=0.3, size=4) +
geom_smooth(color = 'black', method='lm', size=1,...)
p
}
g <- ggpairs(
data = mtcars,
lower = list(
continuous = wrap(lowerFn) #wrap("smooth", alpha = 0.3, color = "blue", lwd=1)
),
upper = list(continuous = wrap("cor", size = 5))
)
g <- g + theme(
axis.text = element_text(size = 6),
axis.title = element_text(size = 6),
legend.background = element_rect(fill = "white"),
panel.grid.major = element_line(colour = NA),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "grey95")
)
print(g, bottomHeightProportion = 0.5, leftWidthProportion = .5)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3734 次 |
| 最近记录: |