Skip to contents

create_trackplot creates a horizontal plot with rows representing separate tracks

Usage

create_trackplot(
  track_data,
  row_id,
  metric_id,
  start_id = "start",
  end_id = "end",
  colour_id = NULL,
  colour_scheme = c("red", "blue"),
  alpha = 1,
  xlimits = c(min(track_data[, start_id]), max(track_data[, end_id])),
  filename = NULL,
  main = NULL,
  main.just = "center",
  main.x = 0.5,
  main.y = 0.5,
  main.cex = 3,
  xlab.label = "Interval Coordinates",
  ylab.label = "Row",
  xlab.cex = 2,
  ylab.cex = 2,
  xlab.col = "black",
  ylab.col = "black",
  xlab.top.label = NULL,
  xlab.top.cex = 2,
  xlab.top.col = "black",
  xlab.top.just = "center",
  xlab.top.x = 0.5,
  xlab.top.y = 0,
  xat = TRUE,
  xaxis.lab = NA,
  yaxis.lab = generate_row_ids(track_data[, row_id]),
  xaxis.cex = 1.5,
  yaxis.cex = 1.5,
  xaxis.rot = 0,
  yaxis.rot = 0,
  xaxis.fontface = "bold",
  yaxis.fontface = "bold",
  xaxis.col = "black",
  yaxis.col = "black",
  xaxis.tck = c(1, 1),
  yaxis.tck = c(1, 1),
  add.grid = FALSE,
  xgrid.at = xat,
  grid.colour = NULL,
  axes.lwd = 1,
  key = list(text = list(lab = c(""))),
  legend = NULL,
  top.padding = 0.1,
  bottom.padding = 0.7,
  right.padding = 0.1,
  left.padding = 0.5,
  key.top = 0.1,
  key.left.padding = 0,
  ylab.axis.padding = 1,
  axis.key.padding = 1,
  add.axes = FALSE,
  axes.lty = "dashed",
  abline.h = NULL,
  abline.v = NULL,
  abline.col = "black",
  abline.lwd = 1,
  abline.lty = 1,
  add.points = FALSE,
  points.x = NULL,
  points.y = NULL,
  points.pch = 19,
  points.col = "black",
  points.col.border = "black",
  points.cex = 1,
  add.line.segments = FALSE,
  line.start = NULL,
  line.end = NULL,
  line.col = "black",
  line.lwd = 1,
  height = 6,
  width = 6,
  size.units = "in",
  resolution = 1600,
  enable.warnings = FALSE,
  ...
)

Arguments

track_data

a dataframe detailing segments

start_id

the start position of the segment, based on histogram vector index

end_id

the end position of the segment, based on histogram vector index

metric_id

values; numeric data for plotting

row_id

character or factor; identifier for the row

colour_id

colour for the row

row_id

character, column name used to indicate the track row

metric_id

character, column name of metric column

start_id

character, column name used to indicate start of intervals, default "start"

end_id

character, column name used to indicate end of intervals, default "end"

colour_id

character, optional, column name for the colour of the track

colour_scheme

a two colour scheme to scale numeric data in the metric_id column, default white, black

alpha

alpha (transparency) of tracks, default 1

xlimits

numeric vector of length 2 indicating the start and end indices of the track respectively

filename

Filename for tiff output, or if NULL returns the trellis object itself

main

The main title for the plot (space is reclaimed if NULL)

main.just

The justification of the main title for the plot, default is centered

main.x

The x location of the main title, deault is 0.5

main.y

The y location of the main title, default is 0.5

main.cex

Size of text for main plot title

xlab.label

x-axis label

ylab.label

y-axis label

xlab.cex

Size of x-axis label, defaults to 3

ylab.cex

Size of y-axis label, defaults to 3

xlab.col

Colour of the x-axis label, defaults to “black”

ylab.col

Colour of the y-axis label, defaults to “black”

xlab.top.label

The label for the top x-axis

xlab.top.cex

Size of top x-axis label

xlab.top.col

Colour of the top x-axis label

xlab.top.just

Justification of the top x-axis label, defaults to centered

xlab.top.x

The x location of the top x-axis label

xlab.top.y

The y location of the top y-axis label

xat

Vector listing where the x-axis labels should be drawn, defaults to automatic

xaxis.lab

Vector listing x-axis tick labels, defaults to automatic

yaxis.lab

Vector listing y-axis tick labels, defaults to automatic

xaxis.cex

Size of x-axis scales, defaults to 2

yaxis.cex

Size of y-axis scales, defaults to 2

xaxis.rot

Counterclockwise rotation of text in x-axis scales in degrees, defaults to 0

yaxis.rot

Counterclockwise rotation of text in y-axis scales in degrees, defaults to 0

xaxis.fontface

Fontface for the x-axis scales

yaxis.fontface

Fontface for the y-axis scales

xaxis.col

Colour of the x-axis tick labels, defaults to “black”

yaxis.col

Colour of the y-axis tick labels, defaults to “black”

xaxis.tck

Specifies the length of the tick mark, defaults to 1 for both top and bottom axes

yaxis.tck

Specifies the length of the tick mark, defaults to 1 for both top and bottom axes

add.grid

Logical stating wheter or not the grid should be drawn on the plot

xgrid.at

Vector listing where the x-axis grid lines should be drawn, defaults to xat

grid.colour

ability to set individual grid line colours

axes.lwd

Thickness of width of axes lines

key

A list giving the key (legend). The default suppresses drawing

legend

Add a legend to the plot. Helpful for adding multiple keys and adding keys to the margins of the plot. See xyplot.

top.padding

A number specifying the distance to the top margin, defaults to 0.1

bottom.padding

A number specifying the distance to the bottom margin, defaults to 0.7

right.padding

A number specifying the distance to the right margin, defaults to 0.1

left.padding

A number specifying the distance to the left margin, defaults to 0.5

key.top

A number specifying the distance at top of key, defaults to 0.1

key.left.padding

Amount of padding to go onto any legend on the left

ylab.axis.padding

A number specifying the distance of ylabel to the y-axis, defaults to 1

axis.key.padding

A number specifying the distance from the y-axis to the key, defaults to 1

add.axes

Allow axis lines to be turned on or off, default is FALSE

axes.lty

Specifies axis line style, defaults to “dashed”

abline.h

Allow horizontal line to be drawn, default to NULL

abline.v

Allow vertical line to be drawn, default to NULL

abline.col

Horizontal line colour, defaults to black

abline.lwd

Specifies horizontal line width, defaults to 1

abline.lty

Specifies horizontal line style, defaults to 1 (solid)

add.points

Allow additional points to be drawn, default is FALSE

points.x

The x co-ordinates where additional points should be drawn

points.y

The y co-ordinates where additional points should be drawn

points.pch

The plotting character for additional points

points.col

The colour of additional points

points.col.border

Colour of the border of additional points if points.pch >= 21. Defaults to black

points.cex

The size of additional points

add.line.segments

Allow additional line segments to be drawn, default is FALSE

line.start

The y co-ordinates where additional line segments should start

line.end

The y co-ordinates where additional line segments should end

line.col

The colour of additional line segments, default is black

line.lwd

The line width of additional line segments, default is 1

height

Figure height, defaults to 6 inches

width

Figure width, defaults to 6 inches

size.units

Figure units, defaults to inches

resolution

Figure resolution in dpi, defaults to 1600

enable.warnings

Print warnings if set to TRUE, defaults to FALSE

...

Additional arguments to be passed to BoutrosLab.plotting.general::create.scatterplot

Value

Track plot, a Trellis object. For further details, see the 'Lattice' R package.

Examples

if (FALSE) {
x = Histogram(c(0, 0, 1, 2, 3, 2, 1, 2, 3, 4, 5, 3, 1, 0))
results = segment_and_fit(x, eps = 0.005)
results_table = summarize_results(results)
create_trackplot(
track_data = results_table,
row_id = "peak_id",
metric_id = "value"
)
}