Learn R Programming

SpeedReader (version 0.9.1)

multi_plot: An implementation of matplot with nice coloring and automatic legend generation

Description

An implementation of matplot with nice coloring and automatic legend generation

Usage

multi_plot(data, plot_columns = NULL, legend_location = "bottomleft",
  xlabel = "", ylabel = "", category = "", output_pdf = FALSE,
  pdf_name = NULL, height = 5, width = 8, connect_with_lines = FALSE,
  order_by_col = NULL, normalize = FALSE)

Arguments

data

A data.frame or matrix we wish to plot.

plot_columns

A numeric vector of column indexes we wish to plot. Defaults to NULL in which case all columns are plotted.

legend_location

Defaults to "bottomleft" but can be changed to any of "left", "topleft", "top", "topright", "right", "bottomright", "bottom".

xlabel

The label we wish to give the X axis. Defaults to no label.

ylabel

The label we wish to give the Y axis. Defaults to no label.

category

The label we wish to give to the legend box.

output_pdf

Defaults to FALSE. If TRUE, then the plot is output to a pdf with pdf_name to the current working directory.

pdf_name

The name we wish to give out pdf. No .pdf extension is required as it is automatically appended.

height

The height of the optional .pdf file generated by this function. Defaults to 5 (inches).

width

The width of the optional .pdf file generated by this function. Defaults to 8 (inches).

connect_with_lines

Logical indicating whether dots should be connected with a line, defaults to FALSE.

order_by_col

Defaults to NULL. If not NULL, then a column index (must be in plot_columns) may be specified. The values of this column are used to sort X values in decreasing order in the resulting plot.

normalize

Defaults to FALSE, if TRUE, then each column will be normalized by dividing it by its maximum absolute value.

Value

A plot.