An object of class "trackViewerStyle" represents track viewer style.

trackViewerStyle(...)

setTrackViewerStyleParam(tvs, attr, value)

# S4 method for class 'trackViewerStyle,character'
setTrackViewerStyleParam(tvs, attr, value)

Arguments

...

Each argument in ... becomes an slot in the new trackViewerStyle.

tvs

An object of trackViewerStyle.

attr

the name of slot to be changed.

value

values to be assigned.

Value

An object of class trackViewerStyle with the modified slot, returned invisibly. The variable supplied as tvs is updated as a side effect.

Details

setTrackViewerStyleParam changes one slot of a trackViewerStyle object. Unlike setTrackStyleParam and its siblings, this style is not attached to a single track: it controls the figure-wide x-axis shared by every track in a plot (drawn once, beneath the bottom-most track), so this function is typically called on the trackViewerStyle object passed to viewTracks, not on a track itself.

Accepted values of attr, all slots of trackViewerStyle:

margin

"numeric" of length 4, the bottom, left, top and right margins of the whole plot, as fractions of the device (each value must be between 0 and 0.8). Default c(.01, .05, 0, 0).

xlas

"numeric" in {0, 1, 2, 3}, the rotation of the x-axis tick labels. See par:las. Ignored when autolas is TRUE.

xgp

"list" of graphical parameters for the x-axis, converted to gpar, e.g. list(cex=.8, col="black"). For the equivalent y-axis settings, see yaxisStyle and setTrackYaxisParam, which are per-track rather than figure-wide.

xaxis

"logical", whether the shared x-axis is drawn at all. Default FALSE.

xat

"numeric" vector of genomic positions at which x-axis tick marks are drawn, passed to grid.xaxis as at. If left at its default (numeric(0)), positions are chosen automatically from the plotted range.

xlabel

"character" vector of labels for the ticks in xat, passed to grid.xaxis as label. Should be the same length as xat when both are set explicitly; left at its default, labels are generated automatically from the tick positions.

autolas

"logical", whether the y-axis label direction is chosen automatically rather than following xlas. Default FALSE.

flip

"logical", whether the x-axis (and the whole plot) is flipped, e.g. to display a feature on the minus strand 5' to 3' left to right. Default FALSE.

Any other value of attr is rejected. Values are assigned with check = TRUE, so the validity method of trackViewerStyle runs on every call — an xlas outside 0:3 or a margin outside [0, 0.8] fails immediately with a descriptive message rather than surfacing later as a plotting error.

Slots

margin

"numeric", specify the bottom, left, top and right margin.

xlas

"numeric", label direction of x-axis mark. It should be a integer 0-3. See par:las

xgp

A "list", object, It will convert to an object of class gpar. This is basically a list of graphical parameter settings of x-axis. For y-axis, see yaxisStyle

xaxis

"logical", draw x-axis or not

xat

"numeric", the values will be passed to grid.xaxis as 'at' parameter.

xlabel

"character", the values will be passed to grid.xaxis as 'label' parameter.

autolas

"logical" automatic determine y label direction

flip

"logical" flip the x-axis or not, default FALSE

Assignment in the calling frame

Like setTrackStyleParam, this method assigns the updated object back to the variable passed as tvs in the caller's environment, so setTrackViewerStyleParam(tvs, "xaxis", TRUE) is sufficient on its own and the result need not be re-assigned. It is also returned invisibly for use in contexts, such as lapply, where that calling-frame assignment has no visible target — see setTrackStyleParam for a worked example of that case.

Examples

tvs <- trackViewerStyle()
setTrackViewerStyleParam(tvs, "xaxis", TRUE)

tvs <- trackViewerStyle()

## turn on the shared x-axis and rotate its labels
setTrackViewerStyleParam(tvs, "xaxis", TRUE)
setTrackViewerStyleParam(tvs, "xlas", 2)

## choose explicit tick positions and labels
setTrackViewerStyleParam(tvs, "xat", c(122929000, 122929500, 122930000))
setTrackViewerStyleParam(tvs, "xlabel", c("122,929,000", "122,929,500", "122,930,000"))

## tighten the plot margins
setTrackViewerStyleParam(tvs, "margin", c(.02, .08, .01, .01))

## flip the plot, e.g. for a minus-strand gene
setTrackViewerStyleParam(tvs, "flip", TRUE)

if (FALSE) { # \dontrun{
## rejected: xlas must be one of 0:3
setTrackViewerStyleParam(tvs, "xlas", 5)
## rejected: not a slot of trackViewerStyle
setTrackViewerStyleParam(tvs, "color", "red")
} # }