Generates the response profile of one or more observations i.e. plots of one or more rows of the outcomes matrix on the y-axis against the \(m\) response variables on the x-axis. Depending on the response type (spectra, gene expression...), point, line or segment plots can be used.
Usage
plotLine(
Y = NULL,
lmpDataList = NULL,
rows = 1,
type = c("l", "p", "s"),
title = "Line plot",
xlab = NULL,
ylab = NULL,
xaxis_type = c("numeric", "character"),
stacked = FALSE,
ncol = 1,
nrow = NULL,
facet_label = NULL,
hline = 0,
size = 0.5,
color = NULL,
shape = 1,
theme = theme_bw(),
ang_x_axis = NULL
)
Arguments
- Y
A numerical matrix containing the rows to be drawn. Can be
NULL
iflmpDataList
is defined.- lmpDataList
If not
NULL
, a list with outcomes, design and formula, as outputted bydata2LmpDataList
.- rows
A vector with either the row name(s) of the \(Y\) matrix to plot (character) or the row index position(s) (integer). Default to 1.
- type
Type of graph to be drawn:
"p"
for point,"l"
for line (default) or"s"
for segment.- title
Plot title.
- xlab
If not
NULL
, label for the x-axis.- ylab
If not
NULL
, label for the y-axis.- xaxis_type
The data type of the x-axis: either
"numeric"
(default) or"character"
.- stacked
Logical. If
TRUE
, will draw stacked plots, otherwise will draw separate plots.- ncol
If
stacked
isFALSE
, the number of columns to represent the separate plots. Default to1
.- nrow
If
stacked
isFALSE
, the number of rows to represent the separate plots.- facet_label
If
stacked
isFALSE
, the labels of the separate plots.- hline
If not
NULL
, draws (a) horizontal line(s), by default at y intercept = 0.- size
Argument of length 1 giving the points size (if
type
=="p"
) or the line size (iftype
=="l"
or"s"
).- color
If not
NULL
, argument of length 1 with possible values:"rows"
, a color name (character) or a numeric value representing a color.- shape
The points shape (default =
1
) iftype
=="p"
.- theme
The
ggplot2
theme (default:theme_bw()
), see?ggtheme
for more info.- ang_x_axis
If not
NULL
, rotation angle to rotate the x-axis text (based on the argumentaxis.text.x
fromggplot2::theme()
)
Examples
data("UCH")
plotLine(Y = UCH$outcomes)
plotLine(lmpDataList = UCH)
# separate plots
plotLine(Y = UCH$outcomes, rows = seq(1, 8), hline = NULL)
plotLine(Y = UCH$outcomes, rows = seq(1, 8), color = 2)
plotLine(Y = UCH$outcomes, rows = seq(1, 8), ncol = 2)
plotLine(
Y = UCH$outcomes, type = "p",
rows = seq(1, 8), ncol = 2
)
# stacked plots
library(ggplot2)
plotLine(
Y = UCH$outcomes, rows = seq(1, 1),
stacked = TRUE, color = "rows"
) +
scale_color_brewer(palette = "Set1")