view_logo {universalmotif} | R Documentation |
Plot logos from numeric matrices.
Description
This function provides the plotting capabilities of view_motifs()
without
requiring universalmotif
-class objects. Instead, it takes a numeric matrix
with row names as input. Additionally, columns can be of any height and
letters can be a mix of different character lengths.
Usage
view_logo(x, fontDF = NULL, fill = "black", colour.scheme = NULL,
min.height = 0.01, x.spacer = 0.04, y.spacer = 0.01,
sort.positions = FALSE, sort.positions.decreasing = TRUE,
fit.to.height = NULL)
Arguments
x |
A numeric matrix with row names. The row names can be a mix of
different character lengths.
|
fontDF |
data.frame or DataFrame Polygon data for letters used
for plotting, as generated by the createPolygons() function from the
gglogo package. See the fontDFroboto data object (which is used
by default when fontDF = NULL ). See Examples for how to generate
your own font set. Expected columns: x , y , order , group ;
additional columns will be ignored.
|
fill |
character A single colour to fill all letters with. Ignored
if colour.scheme is provided.
|
colour.scheme |
character A named character vector of colour names.
Provide colours for individual letters, even if the row names are made
up of multiple characters.
|
min.height |
numeric(1) Minimum height for a letter to be plotted.
The number is taken as the fraction of the total height of the plot.
The default value is to not show letters which take up 1% or less of the
vertical space. For smaller figures it is recommended to increase this
value, and vice versa for larger figures.
|
x.spacer |
numeric(1) Add horizontal spacing between letters. The
number is taken as the fraction of the width of an individual position.
Increasing this value is recommended for letters made up of multiple
characters.
|
y.spacer |
numeric(1) Add vertical spacing between letters. The
number is taken as the fraction nof the total height of the plot.
|
sort.positions |
logical(1) Sort letters vertically per position
by height.
|
sort.positions.decreasing |
logical(1) Sort in decreasing or
increasing order based on letter height.
|
fit.to.height |
numeric(1) Normalize the per position height to
this value. If NULL , no normalization is applied. Note that this
parameter is ignored if use.type = c("PWM", "ICM") .
|
Value
A ggplot
object. If you wish to plot the data yourself from
polygon paths, access them using $data
on the output object. The
theme theme_void()
is applied to the object; apply your own theme
or adjust specific plot parameters with theme()
to change this.
Author(s)
Benjamin Jean-Marie Tremblay, benjamin.tremblay@uwaterloo.ca
See Also
view_motifs()
Examples
## Feel free to mix and match row name character lengths and column sums.
data(examplemotif)
toplot <- examplemotif["motif"]
toplot[4] <- 2
toplot[20] <- -0.5
rownames(toplot)[1] <- "AA"
view_logo(toplot)
[Package
universalmotif version 1.12.0
Index]