| Title: | Circular Plots |
|---|---|
| Description: | Tools to make circular plots. |
| Authors: | Karl W Broman [aut, cre]
|
| Maintainer: | Karl W Broman <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1-4 |
| Built: | 2026-06-04 19:23:57 UTC |
| Source: | https://github.com/kbroman/circplot |
Plot LOD curves for a genome scan as a circle
plot_scan1_circ( x, map, lodcolumn = 1, chr = NULL, gap = NULL, rlim = c(5, 6), start_angle = pi, clockwise = TRUE, xlim = NULL, ylim = NULL, chr_labels = TRUE, lwd = 2, col = "slateblue", lty = 1, add = FALSE, ... )plot_scan1_circ( x, map, lodcolumn = 1, chr = NULL, gap = NULL, rlim = c(5, 6), start_angle = pi, clockwise = TRUE, xlim = NULL, ylim = NULL, chr_labels = TRUE, lwd = 2, col = "slateblue", lty = 1, add = FALSE, ... )
x |
Output of |
map |
A list of vectors of marker positions, as produced by
|
lodcolumn |
LOD score column to plot (a numeric index, or a character string for a column name). Only one value allowed. |
chr |
Selected chromosomes to plot; a vector of character strings. |
gap |
Gap between chromosomes. The default is 1% of the total genome length. |
rlim |
radius limits |
start_angle |
angle to start |
clockwise |
If true, go clockwise |
xlim |
x-axis limits |
ylim |
y-axis limits |
chr_labels |
Whether to add chromosome labels |
lwd |
line width for LOD curves |
col |
color for LOD curves |
lty |
line type for LOD curves |
add |
Add curves to previous plot (need care about matching |
... |
Additional graphics parameters |
No return value
library(qtl2) iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2")) map <- insert_pseudomarkers(iron$gmap, step=1) probs <- calc_genoprob(iron, map, error_prob=0.002) pheno <- iron$pheno covar <- match(iron$covar$sex, c("f", "m")) # make numeric names(covar) <- rownames(iron$covar) Xcovar <- get_x_covar(iron) out <- scan1(probs, pheno, addcovar=covar, Xcovar=Xcovar) kinship <- calc_kinship(probs, "loco") out_lmm <- scan1(probs, pheno, kinship, covar, Xcovar) max_lod <- max(c(maxlod(out), maxlod(out_lmm))) plot_scan1_circ(out, map, ylim=c(0, max_lod), rlim=c(5, 7)) plot_scan1_circ(out_lmm, map, col="violetred", lty=2, add=TRUE, ylim=c(0, max_lod), rlim=c(5, 7))library(qtl2) iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2")) map <- insert_pseudomarkers(iron$gmap, step=1) probs <- calc_genoprob(iron, map, error_prob=0.002) pheno <- iron$pheno covar <- match(iron$covar$sex, c("f", "m")) # make numeric names(covar) <- rownames(iron$covar) Xcovar <- get_x_covar(iron) out <- scan1(probs, pheno, addcovar=covar, Xcovar=Xcovar) kinship <- calc_kinship(probs, "loco") out_lmm <- scan1(probs, pheno, kinship, covar, Xcovar) max_lod <- max(c(maxlod(out), maxlod(out_lmm))) plot_scan1_circ(out, map, ylim=c(0, max_lod), rlim=c(5, 7)) plot_scan1_circ(out_lmm, map, col="violetred", lty=2, add=TRUE, ylim=c(0, max_lod), rlim=c(5, 7))
convert standard cartesian coordiates to coordinates in a circular plot
xy2circ( x, y = NULL, xlim = NULL, ylim = NULL, rlim = c(1, 2), start_angle = pi, clockwise = TRUE )xy2circ( x, y = NULL, xlim = NULL, ylim = NULL, rlim = c(1, 2), start_angle = pi, clockwise = TRUE )
x |
vector of x coordinates, or a 2-column matrix with columns x and y |
y |
vector of y coordinates (ignored if x is a 2-column matrix) |
xlim |
x-axis limits |
ylim |
y-axis limits |
rlim |
radius limits for plot |
start_angle |
angle to start |
clockwise |
If true, go clockwise |
2-column data frame of (x,y) locations in circle plot
x <- seq(0, 18*pi, len=251) y <- sin(x) rlim <- c(4, 7) xl <- c(-rlim[2], rlim[2])*1.1 yl <- range(y) par(bty="n", pty="s") plot(0, 0, type="n", xaxs="i", yaxs="i", xlim=xl, ylim=xl, xaxt="n", yaxt="n", xlab="", ylab="") pos <- xy2circ(x, y, rlim=rlim) lines(pos, lwd=2, col="slateblue") circ <- xy2circ(x, rep(0, length(x)), rlim=rlim, ylim=yl) lines(circ, lwd=2)x <- seq(0, 18*pi, len=251) y <- sin(x) rlim <- c(4, 7) xl <- c(-rlim[2], rlim[2])*1.1 yl <- range(y) par(bty="n", pty="s") plot(0, 0, type="n", xaxs="i", yaxs="i", xlim=xl, ylim=xl, xaxt="n", yaxt="n", xlab="", ylab="") pos <- xy2circ(x, y, rlim=rlim) lines(pos, lwd=2, col="slateblue") circ <- xy2circ(x, rep(0, length(x)), rlim=rlim, ylim=yl) lines(circ, lwd=2)