Custom group mean function for ggpairs

As per the documentation of the ggpairs() function in the GGally R package, it is possible to specify custom functions as input to the "lower"/"upper" argument. For continuous-discrete variable combinations, I would like to simply display the means of the continuous variable within the categories of the categorical variable (preferably using dots, not bars), if possible furth

ggpairs的自定义组平均函数

根据GGally R软件包中ggpairs()函数的文档,可以将自定义函数指定为“lower”/“upper”参数的输入。 对于连续离散变量组合,我想简单地在分类变量的类别中显示连续变量的方法(最好使用点而不是小节),如果可能的话,使用颜色美学进一步分类为另一个分类变量。 我在以下线程中找到了一些信息: https://github.com/ggobi/ggally/issues/218 然而,我对ggpairs(和ggplot2)的了解太过肤浅,无法从线程中的模板生成这样的

Coloring points based on variable with R ggpairs

I'm trying to reproduce the figure in https://tgmstat.wordpress.com/2013/11/13/plot-matrix-with-the-r-package-ggally/ with the code require(GGally) data(tips, package="reshape") ggpairs(data=tips, title="tips data", colour = "sex") However, in the plot I get the points are not colored based on sex, instead they are all the same color. I get the following warning Warning message: In warn

基于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'被忽略。 如果这些都是为了美

R, ggplot2 add legend with different data frames (of different sizes)

I'm trying to make a simple geom_point plot using ggplot2, but I cannot get a legend to appear. I have two data frames I am plotting from that are different lengths (~2000 rows vs ~6000 rows). I have tried adding things like 'scale_shape_manual(values=c(21, 23)' to get it to pop up, but this has not worked. I have also tried adding 'shape = 21' into aes and 'shape = 23&

R,ggplot2添加具有不同数据帧(不同大小)的图例

我正在尝试使用ggplot2创建一个简单的geom_point图,但我无法获取图例出现。 我有两个数据框,我绘制的是不同的长度(〜2000行vs〜6000行)。 我曾尝试添加诸如'scale_shape_manual(values = c(21,23)'之类的东西来让它弹出,但这并没有奏效。我也尝试将'shape = 21'添加到aes和'shape = 23'中aes为他们各自的geom_point调用,但我得到错误'错误:提供给离散量程的连续值'。感谢您的帮助

How to customize lines in ggpairs [GGally]

I have the following plot: Generated with this code: library("GGally") data(iris) ggpairs(iris[, 1:4], lower=list(continuous="smooth", params=c(colour="blue")), diag=list(continuous="bar", params=c(colour="blue")), upper=list(params=list(corSize=6)), axisLabels='show') My questions are: How can I change the correlation line to be red , now it's black. And the correlation line is

如何在ggpairs中自定义行[GGally]

我有以下情节: 使用此代码生成: library("GGally") data(iris) ggpairs(iris[, 1:4], lower=list(continuous="smooth", params=c(colour="blue")), diag=list(continuous="bar", params=c(colour="blue")), upper=list(params=list(corSize=6)), axisLabels='show') 我的问题是: 我如何将相关线改为red ,现在是黑色。 相关线埋在散点图之下。 我想把它放在最上面。 我怎样才能做到这一点? 我希望有一个更

How to make a bubble chart with GGally::ggpairs?

I would like to create a bubble chart matrix using GGally::ggpairs . Defining the point/bubble size in ggplot2 is easy using the size argument: library("ggplot2") data(mtcars) p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(aes(size = qsec)) However, with GGally::ggpairs this does not work. The following code produces this: library("GGally") ggpairs(mtcars[ ,c("mpg", "wt", "disp")],

如何用GGally :: ggpairs制作气泡图?

我想用GGally::ggpairs创建一个气泡图矩阵。 使用size参数定义ggplot2的点/气泡大小很简单: library("ggplot2") data(mtcars) p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(aes(size = qsec)) 但是,对于GGally::ggpairs这不起作用。 下面的代码产生这个: library("GGally") ggpairs(mtcars[ ,c("mpg", "wt", "disp")], size=mtcars$qsec) 下面的代码甚至不会生成一个图 ggpairs(mtcars[ ,c("mpg",

How to draw loess estimation in GGally using ggpairs?

I tried GGally package a little bit. Especially the ggpairs function. However, I cannot figure out how to use loess instead of lm when plot smooth. Any ideas? Here is my code: require(GGally) diamonds.samp <- diamonds[sample(1:dim(diamonds)[1],200),] ggpairs(diamonds.samp[,c(1,5)], lower = list(continuous = "smooth"), params = c(method = "loess"), axisLabels = "sh

如何使用ggpairs在GGally中绘制黄土估计?

我尝试了GGally包装一点。 特别是ggpairs功能。 但是,当情节平滑时,我不知道如何使用黄土而不是lm。 有任何想法吗? 这是我的代码: require(GGally) diamonds.samp <- diamonds[sample(1:dim(diamonds)[1],200),] ggpairs(diamonds.samp[,c(1,5)], lower = list(continuous = "smooth"), params = c(method = "loess"), axisLabels = "show") 谢谢! PS与plotmatrix函数相比,ggpairs要

Correlation matrix plot with ggplot2

I want to create a correlation matrix plot, ie a plot where each variable is plotted in a scatterplot against each other variable like with pairs() or splom() . I want to do this with ggplot2. See here for examples. The link mentions some code someone wrote for doing this in ggplot2, however, it is outdated and no longer works (even after you swap out the deprecated parts). One could do this

用ggplot2绘制相关矩阵图

我想要创建一个相关矩阵图,即每个变量都绘制在散点图中,并与pairs()或splom()等其他变量一起绘制。 我想用ggplot2来做到这一点。 请看这里的例子。 该链接提到了某人在ggplot2中为此编写的代码,但是,该代码已过时并且不再有效(甚至在您更换弃用的部分之后)。 人们可以在一个循环中进行循环,然后使用multiplot() ,但必须有更好的方法。 我尝试将数据集融化为长,然后复制值和变量变量,然后使用构面。 这几乎给你

Create a matrix of scatterplots (pairs() equivalent) in ggplot2

Is it possible to plot a matrix of scatter plots with ggplot2 , using ggplot 's nice features like mapping additional factors to color, shape etc. and adding smoother? I am thinking about something similar to the base function pairs . You might want to try plotmatrix: library(ggplot2) data(mtcars) plotmatrix(mtcars[,1:3]) to me mpg (first column in mtcars) should not be a factor.

在ggplot2中创建散点图的矩阵(对()等价)

是否可以用ggplot2绘制散点图的矩阵,使用ggplot的很好的功能,如将其他因素映射到颜色,形状等,并添加更平滑? 我正在考虑类似于base函数pairs东西。 你可能想试试plotmatrix: library(ggplot2) data(mtcars) plotmatrix(mtcars[,1:3]) 对我来说mpg(mtcars中的第一列)不应该是一个因素。 我没有检查过它,但没有理由为什么它应该是一个。 但是我得到一个散点图:) 注意:为了将来的参考, plotmatrix()函数

labels for custom diverging color gradient in ggplot

I would like to plot some data where I use a custom transformation for a diverging color scale. As shown here, the labels come in funky or sometimes not at all. I would like for the labels to be rounded and to show the value the color represents and not the transformation. I have been able to successfully apply it to a non-negative scale and I believe it has something do to with the negative

ggplot中自定义渐变颜色渐变的标签

我想绘制一些数据,在这里我使用一种自定义转换来分散色彩比例。 如此处所示,标签有时甚至根本没有。 我希望标签能够圆整,并显示颜色代表的价值而不是转型。 我已经能够成功地将其应用于非负面的规模,我相信它对trans_new的负数或inverse调用trans_new ,我从文档中不太明白: 以下是我探索的一些链接: R:自定义ggplot2颜色转换给标签中的错误 GGplot自定义刻度转换与自定义刻度 https://github.com/tidyverse/

like clusters in ggplot with nmds?

I have just successfully managed to plot and ordisurf model on top of my non-metric multi dimensional scale plot. Code was used from this site. https://oliviarata.wordpress.com/2014/07/17/ordinations-in-ggplot2-v2-ordisurf/ However my problem is that I am having a hard time trying to figure out how to plot cluster graphics using ggplot. I've looked around and the closest I came to was th

像ggplot中的群集与nmds?

我刚刚成功地在我的非公制多维尺度图上成功绘制了绘制和ordisurf模型。 代码是从这个网站使用的。 https://oliviarata.wordpress.com/2014/07/17/ordinations-in-ggplot2-v2-ordisurf/ 然而,我的问题是,我很难想出如何使用ggplot绘制集群图形。 我环顾四周,最接近我是这样的:R - 添加质心散点图 答案涉及创建质心和从它到点的延长线,但这不是用nmds对象完成的,所以我仍然感到困惑。 我用纯素来运行我的nmds和gpp