考虑这个例子:
data(tips, package = "reshape")
library(GGally)
pm <- ggpairs(tips, mapping = aes(color = sex), columns = c("total_bill", "time", "tip"))
pm
如何使密度图更透明并去除黑线?
这些GGally
软件包最近似乎发生了很大变化,我找不到可行的解决方案
更新
我发现如何使用自定义函数更改 alpha:
my_dens <- function(data, mapping, ..., low = "#132B43", high = "#56B1F7") {
ggplot(data = data, mapping=mapping) +
geom_density(..., alpha=0.7)
}
pm <- ggpairs(tips, mapping = aes(color = sex), columns = c("total_bill", "time", "tip"),
diag=list(continuous=my_dens))
pm
但黑线仍然存在。