隨着在GGally :: ggpairs中編輯單個ggplots:我如何讓密度圖未在ggpairs中填充?
library(GGally)
data(diamonds, package="ggplot2")
diamonds.samp <- diamonds[sample(1:dim(diamonds)[1],200),]
# Custom Example
ggpairs(
diamonds.samp[,1:5],
mapping = ggplot2::aes(color = cut),
upper = list(continuous = wrap("density", alpha = 0.5), combo = "box"),
lower = list(continuous = wrap("points", alpha = 0.3), combo = wrap("dot", alpha = 0.4)),
diag = list(continuous = wrap("densityDiag")),
title = "Diamonds"
)
我得到
如何使對角線密度圖不被填補,只列出了?
種類的作品...但不是真的。
這真的很醜 - 就代碼而言 - 因爲它對我沒有任何意義。另外,它在這裏不起作用,因爲它也改變了直方圖。
ggpairs(
diamonds.samp[,1:5],
mapping = ggplot2::aes(color = cut),
upper = list(continuous = wrap("density", alpha = 0.5), combo = "box"),
lower = list(continuous = wrap("points", alpha = 0.3), combo = wrap("dot", alpha = 0.4)),
diag = list(continuous = wrap("densityDiag"), mapping = ggplot2::aes(fill=carat)),
title = "Diamonds"
)
發現也看到https://github.com/bbolker/stat744/ blob/master/lectures/explore_multiway.R#L109 –