基于R ggpairs变量的着色点

我试图用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") 

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

警告消息:在warn_if_args_exist(list(...))中:额外的参数:'color'被忽略。 如果这些都是为了美学,请使用ggpairs中的'mapping'变量将它们提交给> ggplot2 :: aes或ggplot2 :: aes_string。

我已经尝试添加ggplot2 :: aes(color = 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)))

wrap()咒语的wiki页面之后,停止关于需要在binwidth中设置binwidthstat_bin ...

在这里输入图像描述

链接地址: http://www.djcxy.com/p/30919.html

上一篇: Coloring points based on variable with R ggpairs

下一篇: R, ggplot2 add legend with different data frames (of different sizes)