1 Star 0 Fork 38

ByUrSideQAQ/ggcor

forked from dr.yingli/ggcor 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
README.Rmd 3.95 KB
一键复制 编辑 原始数据 按行查看 历史
houyun 提交于 2020-07-20 19:56 . update readme
output
github_document
```{r, include = FALSE} knitr::opts_chunk$set( message = FALSE, collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", fig.align = "center", out.width = "100%" ) ``` # ggcor The goal of `ggcor` is to provide a set of functions that can be used to visualize a correlation matrix quickly. ## Installation Now `ggcor` is not on cran, You can install the development version of ggcor from [GitHub](https://github.com/) with: ``` r # install.packages("devtools") devtools::install_github("houyunhuang/ggcor") ``` If you are in the mainland of China, you can install ggcor from [Gitee](https://gitee.com) with: ``` r # install.packages("devtools") devtools::install_git("https://gitee.com/houyunhuang/ggcor.git") ``` ## Correlation plot ```{r example01} library(ggplot2) library(ggcor) set_scale() quickcor(mtcars) + geom_square() quickcor(mtcars, type = "upper") + geom_circle2() quickcor(mtcars, cor.test = TRUE) + geom_square(data = get_data(type = "lower", show.diag = FALSE)) + geom_mark(data = get_data(type = "upper", show.diag = FALSE), size = 2.5) + geom_abline(slope = -1, intercept = 12) ``` ## Mantel test plot ```{r example03,fig.height=4.6} library(dplyr) data("varechem", package = "vegan") data("varespec", package = "vegan") mantel % mutate(rd = cut(r, breaks = c(-Inf, 0.2, 0.4, Inf), labels = c("< 0.2", "0.2 - 0.4", ">= 0.4")), pd = cut(p.value, breaks = c(-Inf, 0.01, 0.05, Inf), labels = c("< 0.01", "0.01 - 0.05", ">= 0.05"))) quickcor(varechem, type = "upper") + geom_square() + anno_link(aes(colour = pd, size = rd), data = mantel) + scale_size_manual(values = c(0.5, 1, 2)) + scale_colour_manual(values = c("#D95F02", "#1B9E77", "#A2A2A288")) + guides(size = guide_legend(title = "Mantel's r", override.aes = list(colour = "grey35"), order = 2), colour = guide_legend(title = "Mantel's p", override.aes = list(size = 3), order = 1), fill = guide_colorbar(title = "Pearson's r", order = 3)) ``` ## Circular heatmap ```{r,fig.height=7} rand_correlate(100, 8) %>% ## require ambient packages quickcor(circular = TRUE, cluster = TRUE, open = 45) + geom_colour(colour = "white", size = 0.125) + anno_row_tree() + anno_col_tree() + set_p_xaxis() + set_p_yaxis() ``` ## General heatmap ```{r,fig.height=7} d1 % gcor_tbl(cluster = TRUE) p % gcor_tbl(name = "Type", row.order = d1) %>% qheatmap(aes(fill = Type)) + coord_fixed() + remove_y_axis() d2
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
R
1
https://gitee.com/byursideqaq/ggcor.git
git@gitee.com:byursideqaq/ggcor.git
byursideqaq
ggcor
ggcor
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385