gpt4 book ai didi

r - 基于变量的着色点与 R ggpairs

转载 作者:行者123 更新时间:2023-12-04 13:22:22 25 4
gpt4 key购买 nike

我正在尝试重现 https://tgmstat.wordpress.com/2013/11/13/plot-matrix-with-the-r-package-ggally/ 中的数字用代码

require(GGally)
data(tips, package="reshape")
ggpairs(data=tips, title="tips data", colour = "sex")

但是,在情节中我得到的点不是基于性别着色的,而是它们都是相同的颜色。我收到以下警告

Warning message: In warn_if_args_exist(list(...)) : Extra arguments: 'colour' are being ignored. If these are meant to be >aesthetics, submit them using the 'mapping' variable within ggpairs with >ggplot2::aes or ggplot2::aes_string.



我试过添加 ggplot2::aes(colour = sex),但这也不起作用。

这里有没有其他人有同样的问题?我正在使用 R 版本 3.3.1 和 GGally_1.2.0。

谢谢。

最佳答案

GGally一直处于相当快速的发展之中,所以 2013 年的一篇博客文章有过时的代码也就不足为奇了。当我用 GGally 运行你的代码时1.2.0 我收到同样的警告。如果我添加映射,它对我有用:

require(GGally)
data(tips, package="reshape")
g1 <- ggpairs(data=tips, title="tips data",
mapping=ggplot2::aes(colour = sex),
lower=list(combo=wrap("facethist",binwidth=1)))

关注 the wiki pagewrap()停止提示需要设置的咒语 binwidthstat_bin ...

enter image description here

关于r - 基于变量的着色点与 R ggpairs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38446804/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com