- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想向散点图矩阵添加抖动。这个问题在 stackoverflow 的下一页(没有其他地方)得到解决:
How to produce a meaningful draftsman/correlation plot for discrete values
但是,建议的抖动问题的两种解决方案都涉及不推荐使用的代码(plotmatrix 和 params):
library(ggplot2)
plotmatrix(y) + geom_jitter(alpha = .2)
library(GGally)
ggpairs(y, lower = list(params = c(alpha = .2, position = "jitter")))
> str(EHRound4.subset)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 301 obs. of 22 variables:
$ Subject# : int 1 2 3 4 6 7 8 13 14 16 ...
$ Condition : Factor w/ 2 levels "CDR","Mturk": 1 1 1 1 1 1 1 1
1 1 ...
$ Launch4 : int 5 8 8 5 8 5 3 8 5 6 ...
$ NewSong4 : int 6 8 8 6 8 6 8 8 8 7 ...
$ StudCom5 : int 6 5 8 3 1 3 4 8 7 7 ...
$ Textbook5 : int 8 1 8 3 1 7 8 8 8 8 ...
> ggpairs(EHRound4.subset, columns = 3:6,
ggplot2::aes(colour=Condition), lower = list(geom_jitter(alpha = .2)))
> ggpairs(EHRound4.subset, columns = 3:6,
ggplot2::aes(colour=Condition, alpha=.2), lower = list(geom_jitter()))
> ggpairs(EHRound4.subset, columns = 3:6,
ggplot2::aes(colour=Condition, alpha=.2, position="jitter"))
最佳答案
@user20650 在问题下方的评论中回答了问题。为了完整起见,这里采用答案的形式:
使用 wrap
, 如:
library(GGally)
ggpairs(y, lower = list(continuous=wrap("points", position=position_jitter(height=3, width=3))))
position = position_jitter()
而不仅仅是
position = "jitter"
(这也有效)额外的抖动参数也可以控制。
关于r - 如何将抖动添加到 ggpairs 中的散点图矩阵?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45044157/
我想更改成对图上直方图条形的颜色,从而为每个变量设置不同的颜色。看来我可以通过将 'fill =' 选项更改为新颜色来更改所有对角直方图的颜色,但是当我尝试替换四种颜色的列表时,我收到错误报告: “r
我定义了一个函数来设置 ggpairs 中的背景,以匹配两个变量之间的相关程度。但是,我还想从沿图外部运行的变量标签中删除灰色背景,但如果不删除相关颜色,我就无法做到这一点。 library(GGal
这段代码产生了一个很好的成对图,在右中角有一个相关读数: library(GGally) ggpairs(esoph[,c(1,4,5)], colour='agegp') 您可以通过以下方式获得相关
我想在下图中获得白色的直方图或条形线。主要是为了省墨。 library(GGally) library(ggplot2) data(tips, package = "reshape") pm <- g
我正在使用 ggpairs() 为一组变量创建散点图和相关性。我的相关图上的文本不适合绘图区域,因为它们被水平调整以在绘图的中途结束。我在 another post 上看到了如何调整顶线关联文本,但它
我正在尝试重现 https://tgmstat.wordpress.com/2013/11/13/plot-matrix-with-the-r-package-ggally/ 中的数字用代码 requ
我试图理解为什么在传递命令 ggpairs(iris, mapping=ggplot2::aes(colour = Species)) 时没有显示相关系数的图 console output 这是它的样
我想向散点图矩阵添加抖动。这个问题在 stackoverflow 的下一页(没有其他地方)得到解决: How to produce a meaningful draftsman/correlation
您知道如何更改 ggpairs 上面板中的标签吗? ( Ggally 包)?我找到了如何更改大小、字体而不是标签。在这里,我想缩短标签(“设置”倒 setosa 等...)。我试着把它放在 label
我可以给 ggpairs 提供一个参数吗? GGally 包中的函数来对一些变量使用对数刻度,而不是所有变量? 最佳答案 您不能提供这样的参数(一个原因是创建散点图的函数是预定义的,没有比例,请参阅
我正在使用 ggpairs 绘制散点图矩阵.我正在使用以下代码: # Load required packages require(GGally) # Load datasets data(state
有一个 ggpairs 函数,如何将较低面的范围限制为例如x 和 y 为 0.5? library(GGally) xy <- data.frame(matrix(runif(4 * 1000), n
这个问题在这里已经有了答案: Order Bars in ggplot2 bar graph (16 个答案) 关闭去年。 我有以下代码: library(GGally) group % ggpai
我在 Shiny 应用程序中有一些代码可以生成下面的第一个图。如您所见,字体大小随相关系数的大小而变化。我想用 ggpairs (GGally) 或 ggplot2 制作类似的东西。下面的第二张图片是
我想用 ggPairs() 创建一个相关图,它应该包含 相关值的热图 ( as in this SO question ) 相关性的重要星 ( as in this SO question ) 字体类
GGally::ggpairs绘制漂亮的图表,如下所示。我唯一想进一步完善它的是删除图上部的所有网格线,其中是相关系数。也可以在每个上图周围绘制矩形。 library("GGally") data(i
我有以下数据集和代码来为数据框中的每对变量构建二维密度等高线图。我的问题是 ggpairs() 中是否有一种方法可以确保不同变量对的尺度相同,就像 ggplot2 中不同方面的尺度相同。例如,我希望每
我无法更改 ggpair 图中的对角线图。我想总体上改变它们的外观,也许从让它们空白开始。这就是我认为应该的样子: ggpairs(data=df, columns=1:3,
在 GGally::ggpair 的最新版本中,相关值用 * 显示,如下图所示。我想删除 *s 并保留相关值。 我看过 ggpairs 代码,但它对我来说并不明显。 GGally::ggpairs(d
我正在尝试创建一个包含 GGally 图的列表对象。这些图均由两个数据集创建,即主数据集和要再次以橙色绘制的主数据集的子集。在下面的 MWE 中,创建了三个图,每个图都比较 mtcars 数据中的两列
我是一名优秀的程序员,十分优秀!