mdaplotg function

Plotting function for several plot series

Plotting function for several plot series

mdaplotg is used to make different kinds of plots or their combination for several sets of objects.

mdaplotg( data, groupby = NULL, type = "p", pch = 16, lty = 1, lwd = 1, cex = 1, col = NULL, bwd = 0.8, legend = NULL, xlab = NULL, ylab = NULL, main = NULL, labels = NULL, ylim = NULL, xlim = NULL, colmap = "default", legend.position = "topright", show.legend = TRUE, show.labels = FALSE, show.lines = FALSE, show.grid = TRUE, grid.lwd = 0.5, grid.col = "lightgray", xticks = NULL, xticklabels = NULL, yticks = NULL, yticklabels = NULL, show.excluded = FALSE, lab.col = "darkgray", lab.cex = 0.65, xlas = 1, ylas = 1, opacity = 1, ... )

Arguments

  • data: a matrix, data frame or a list with data values (see details below).
  • groupby: one or several factors used to create groups of data matrix rows (works if data is a matrix)
  • type: type of the plot ('p', 'l', 'b', 'h', 'e').
  • pch: a character for markers (same as plot parameter).
  • lty: the line type (same as plot parameter).
  • lwd: the line width (thickness) (same as plot parameter).
  • cex: the cex factor for the markers (same as plot parameter).
  • col: colors for the plot series
  • bwd: a width of a bar as a percent of a maximum space available for each bar.
  • legend: a vector with legend elements (if NULL, no legend will be shown).
  • xlab: a title for the x axis (same as plot parameter).
  • ylab: a title for the y axis (same as plot parameter).
  • main: an overall title for the plot (same as plot parameter).
  • labels: what to use as labels ('names' - row names, 'indices' - row indices, 'values' - values).
  • ylim: limits for the y axis (if NULL, will be calculated automatically).
  • xlim: limits for the x axis (if NULL, will be calculated automatically).
  • colmap: a colormap to generate colors if col is not provided
  • legend.position: position of the legend ('topleft', 'topright', 'top', 'bottomleft', 'bottomright', 'bottom').
  • show.legend: logical, show or not legend for the data objects.
  • show.labels: logical, show or not labels for the data objects.
  • show.lines: vector with two coordinates (x, y) to show horizontal and vertical line cross the point.
  • show.grid: logical, show or not a grid for the plot.
  • grid.lwd: line thinckness (width) for the grid
  • grid.col: line color for the grid
  • xticks: tick values for x axis.
  • xticklabels: labels for x ticks.
  • yticks: tick values for y axis.
  • yticklabels: labels for y ticks.
  • show.excluded: logical, show or hide rows marked as excluded (attribute exclrows)
  • lab.col: color for data point labels.
  • lab.cex: size for data point labels.
  • xlas: orientation of xticklabels
  • ylas: orientation of yticklabels
  • opacity: opacity for plot colors (value between 0 and 1)
  • ...: other plotting arguments.

Details

The mdaplotg function is used to make a plot with several sets of objects. Simply speaking, use it when you need a plot with legend. For example to show line plot with spectra from calibration and test set, scatter plot with height and weight values for women and men, and so on.

Most of the parameters are similar to mdaplot, the difference is described below.

The data should be organized as a list, every item is a matrix (or data frame) with data for one set of objects. Alternatively you can provide data as a matrix and use parameter groupby to create the groups. See tutorial for more details.

There is no color grouping option, because color is used to separate the sets. Marker symbol, line style and type, etc. can be defined as a single value (one for all sets) and as a vector with one value for each set.

Author(s)

Sergey Kucheryavskiy (svkucheryavski@gmail.com)

  • Maintainer: Sergey Kucheryavskiy
  • License: MIT + file LICENSE
  • Last published: 2024-08-19