plotApa: Plots Aggregate Peak Analysis Matrix

View source: R/plotApa.R

plotApaR Documentation

Plots Aggregate Peak Analysis Matrix

Description

Plots Aggregate Peak Analysis Matrix

Usage

plotApa(
  params = NULL,
  apa,
  x = NULL,
  y = NULL,
  width = NULL,
  height = NULL,
  just = c("left", "top"),
  default.units = "inches",
  draw = TRUE,
  palette = colorRampPalette(c("white", "dark red")),
  n = NULL,
  zrange = NULL
)

Arguments

params

optional "pgParams" object containing relevant function parameters

x

numeric or unit object specifying x-location of plot

y

numeric or unit object specifying y-location of plot

width

numeric or unit object specifying width of plot

height

numeric or unit object specifying height of plot

just

string or numeric vector specifying the justification of the viewport relative to its (x, y) location

default.units

string indicating the default units to use if x, y, width, or height are only given as numeric vectors

draw

logical value indicating whether graphics output should be produced

palette

colorRampPalette function to use to map values to colors

n

numeric by which to divide aggregate matrix

zrange

vector of length 2; max and min values to set color scale

data

matrix, list of matricies, or 3 column data.frame of APA results

Value

Function will draw a APA matrix and return an object of class "apa"

Examples


## Create divergent matrix ####
m <- matrix(data = rnorm(n = 21*21, mean = 0, sd = 2), nrow = 21, ncol = 21)

## Define parameters
p <- pgParams(width = 3, height = 3, default.units = "inches")

## Create page
pageCreate(params = p)

## Plot apa
plot <- plotApa(apa = m,
                x = p$width/2, y = p$height/2,
                width = p$width*0.5, height = p$width*0.5, just = c("center", "center"),
                palette = colorRampPalette(c("blue", "white", "red")), zrange = NULL)

## Annotate legend
annoHeatmapLegend(plot = plot,
                  x = 2.3, y = 0.75, width = 0.1, height = 0.75)


## Create sequential matrix
m <- matrix(data = sample(0:100, 21*21, replace = T), nrow = 21, ncol = 21)

## Define parameters
p <- pgParams(width = 3, height = 3, default.units = "inches")

## Create page
pageCreate(params = p)

## Plot apa
plot <- plotApa(apa = m,
                x = p$width/2, y = p$height/2,
                width = p$width*0.5, height = p$width*0.5, just = c("center", "center"),
                palette = colorRampPalette(c("white", "dark red")), zrange = NULL)

## Annotate legend
annoHeatmapLegend(plot = plot,
                  x = 2.3, y = 0.75, width = 0.1, height = 0.75)



EricSDavis/hictoolsr documentation built on Sept. 4, 2022, 12:36 a.m.