当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


R corrr rplot 绘制相关 DataFrame 。


使用 ggplot2 绘制相关 DataFrame 。

用法

rplot(
  rdf,
  legend = TRUE,
  shape = 16,
  colours = c("indianred2", "white", "skyblue1"),
  print_cor = FALSE,
  colors,
  .order = c("default", "alphabet")
)

参数

rdf

相关数据帧(请参阅 correlate )或可以强制为一的对象(请参阅 as_cordf )。

legend

布尔值,指示是否应显示将颜色映射到相关性的图例。

shape

geom_point美学。

colours, colors

用于 n-color 渐变的颜色向量。

print_cor

指示是否应在形状上打印相关性的布尔值。

.order

"default"(表示 x 和 y 变量与 x 中的列保持相同的顺序)或 "alphabet"(表示变量按字母顺序排列)。

绘制相关 DataFrame

细节

相关 DataFrame 中的每个值由输出图中的一个点/圆表示。每个点的大小对应于相关性的绝对值(通过size美学)。每个点的颜色对应于相关性的有符号值(通过color美学)。

例子

x <- correlate(mtcars)
#> Correlation computed with
#> • Method: 'pearson'
#> • Missing treated using: 'pairwise.complete.obs'
rplot(x)


# Common use is following rearrange and shave
x <- rearrange(x, absolute = FALSE)
x <- shave(x)
rplot(x)

rplot(x, print_cor = TRUE)

rplot(x, shape = 20, colors = c("red", "green"), legend = TRUE)

源代码:R/output.R

相关用法


注:本文由纯净天空筛选整理自Max Kuhn等大神的英文原创作品 Plot a correlation data frame.。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。