plot2Ds {pRoloc} | R Documentation

## Draw 2 data sets on one PCA plot

### Description

Takes 2 `linkS4class{MSnSet}` instances as input to plot the two data sets on the same PCA plot. The second data points are projected on the PC1 and PC2 dimensions calculated for the first data set.

### Usage

    plot2Ds(object, pcol, fcol = "markers", cex.x = 1, cex.y = 1,
      pch.x = 21, pch.y = 23, col, mirrorX = FALSE, mirrorY = FALSE,
      plot = TRUE, ...)

### Arguments

`object` | An `MSnSet` or a `MSnSetList`. In the latter case, only the two first elements of the list will be used for plotting and the others will be silently ignored.
`pcol` | If `object` is an `MSnSet`, a `factor` or the name of a phenotype variable (`phenoData` slot) defining how to split the single `MSnSet` into two or more data sets. Ignored if `object` is a `MSnSetList`.
`fcol` | Feature meta-data label (fData column name) defining the groups to be differentiated using different colours. Default is `markers`. Use `NULL` to suppress any colouring.
`cex.x` | Character expansion for the first data set. Default is 1.
`cex.y` | Character expansion for the second data set. Default is 1.
`pch.x` | Plotting character for the first data set. Default is 21.
`pch.y` | Plotting character for the second data set. Default is 23.
`col` | A vector of colours to highlight the different classes defined by `fcol`. If missing (default), default colours are used (see `getStockcol`).
`mirrorX` | A `logical` indicating whether the x axis should be mirrored?
`mirrorY` | A `logical` indicating whether the y axis should be mirrored?
`plot` | If `TRUE` (default), a plot is produced.
`...` | Additinal parameters passed to `plot` and `points`.

### Value

Used for its side effects of producing a plot. Invisibly returns an object of class `plot2Ds`, which is a list with the PCA analyses results (see `prcomp`) of the first data set and the new coordinates of the second data sets, as used to produce the plot and the respective point colours. Each of these elements can be accessed with `data1`, `data2`, `col1` and `code2` respectively.

### Author(s)

Laurent Gatto

### See Also

See `plot2D` to plot a single data set and `move2Ds` for a animation.

### Examples

    library("pRolocdata")
    data(tan2009r1)
    data(tan2009r2)
    msnl <- MSnSetList(list(tan2009r1, tan2009r2))
    plot2Ds(msnl)
    ## tweaking the parameters
    plot2Ds(list(tan2009r1, tan2009r2),
            fcol = NULL, cex.x = 1.5)
    ## input is 1 MSnSet containing 2 data sets
    data(dunkley2006)
    plot2Ds(dunkley2006, pcol = "replicate")
    ## no plot, just the data
    res <- plot2Ds(dunkley2006, pcol = "replicate",
                   plot = FALSE)
    res
    head(data1(res))
    head(col1(res))

[Package pRoloc version 1.30.0 Index]