Skip to content
/ ggLD Public

Visualizing correlation matrix using ggplot2

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

mmkim1210/ggLD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ggLD

An R package to visualize a correlation matrix (e.g. LD matrix) using ggplot2 and the diagonal on the x-axis. The package as it is can visualize more than 1,000 features (e.g. SNPs) fast.

Installation

devtools::install_github("mmkim1210/ggLD")

Example

# Load relevant packages
library(tidyverse)
library(ggLD)

# ggplot2
df <- abs(cor(data.frame(a = rnorm(20), 
                         b = rnorm(20), 
                         c = rnorm(20),
                         d = rnorm(20),
                         e = rnorm(20))))
ggLD(data = df)

# Visualize with the right (square) aspect ratio
n <- dim(df)[1]
ggLD(data = df) + 
    theme(legend.position = "none") + 
    theme(aspect.ratio = (1 / n  + (n - 1) / (2 * n)))

The following is a real example of SNP data from chromosome 7 for ~3,000 SNPs.

About

Visualizing correlation matrix using ggplot2

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Languages