Learn R Programming

LDheatmap (version 1.0-6)

LDheatmap.addScatterplot: Add a scatter plot to an LDheatmap object

Description

Add a scatter plot to an LDheatmap object. The x axis is the map of genetic distances of the SNPs.

Usage

LDheatmap.addScatterplot(LDheatmap, P, height = 0.2, ylab = NULL, ylim=NULL,
type = "points")

Arguments

LDheatmap

An object of class LDheatmap.

P

A vector with the values to be plotted as the y axis.

height

The height of the plot.

ylab

The y axis label.

ylim

The y axis limits.

type

Plot type. Possible values are "points" (the default), "lines" or "both".

Value

An object of class LDheatmap given as an argument, with the grob LDheatmapGrob modified to inclue the "association" child grob.

Details

The function creates an "association" grob and adds it to the LDheatmap object. Then it pushes a viewport and draws the LDheatmapGrob onto it.

See Also

LDheatmap

Examples

Run this code
# NOT RUN {
# Load the package's data set
data("CEUSNP"); data("CEUDist")
# Produce an LDheatmap object
MyLDheatmap <- LDheatmap(CEUSNP, genetic.distances = CEUDist, flip = TRUE)
# Generate an arbitrary vector of values to plot
Yvalues <- seq(length = length(MyLDheatmap$genetic.distances), from = 0.01, to = 0.5)
# Add scatter plot
assoc <- LDheatmap.addScatterplot(MyLDheatmap, Yvalues)
######## Adding three or more scatter plots ########
# Redefine LDheatmap.addScatterplot() to display the third scatter plot
LDheatmap.addScatterplot_test3 <- function(LDheatmap, P, height=0.2, ylab=NULL, 
ylim=NULL, type="points",color,pch) {
if (dim(LDheatmap$LDmatrix)[1] != length(P)) {
print("Length of vector not equal number of SNPs in LDheatmap")
return()

flip <- !is.null(LDheatmap$flipVP)
vp <- constructVP(LDheatmap$LDheatmapGrob, 0.23, flip)
......
return(LDheatmap)
}}
environment(LDheatmap.addScatterplot_test3) <- asNamespace('LDheatmap')

# }

Run the code above in your browser using DataLab