plotLine: Line plot

View source: R/plotLine.R

plotLineR Documentation

Line plot

Description

Generates the response profile of one or more observation 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 are offered.

Usage

plotLine(
  Y,
  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()
)

Arguments

Y

A numerical matrix containing the rows to be drawn.

rows

A vector with either the row name(s) of the Y matrix to plot (character) or the row index position(s).

type

Type of graph to be drawn: "p" for point, "l" for line 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" or "character".

stacked

Logical. If TRUE, will draw stacked plots, otherwise will draw separate plots.

ncol

If stacked is FALSE, the number of columns to represent the separate plots.

nrow

If stacked is FALSE, the number of rows to represent the separate plots.

facet_label

If stacked is FALSE, the labels of the separate plots.

hline

If not NULL, draws (a) horizontal line(s).

size

Argument of length 1 giving the points size (if type == "p") or the line size (if type == "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 if type == "p" (argument of length 1).

theme

ggplot theme, see ?ggtheme for more info.

Value

A line plot (ggplot).

Examples


plotLine(Y = UCH$outcomes)

# separate plots
plotLine(Y = UCH$outcomes, rows = c(1:4), hline = NULL)
plotLine(Y = UCH$outcomes, rows = c(1:4), color = 2)
plotLine(Y = UCH$outcomes, rows = c(1:8), ncol=2)
plotLine(Y = UCH$outcomes, type = "p",
         rows = c(1:8), ncol=2)

# stacked plots
library(ggplot2)
plotLine(Y = UCH$outcomes, rows = c(1:4),
         stacked = TRUE, color = "rows") +
         scale_color_brewer(palette="Set1")


bgovaerts/LMWiRe documentation built on Sept. 17, 2022, 12:32 a.m.