plot-SlingshotDataSet {slingshot} | R Documentation

## Plot Slingshot output

### Description

Tools for visualizing lineages inferred by `slingshot`.

### Usage

    ## S3 method for class 'SlingshotDataSet'
    plot(
      x,
      type = NULL,
      linInd = NULL,
      show.constraints = FALSE,
      add = FALSE,
      dims = seq_len(2),
      asp = 1,
      cex = 2,
      lwd = 2,
      col = 1,
      ...
    )

    ## S3 method for class 'SlingshotDataSet'
    lines(x, type = NULL, dims = seq_len(2), ...)

### Arguments

`x` | a `SlingshotDataSet` with results to be plotted.
`type` | character, the type of output to be plotted, can be one of `"lineages"`, `"curves"`, or `"both"` (by partial matching), see Details for more.
`linInd` | integer, an index indicating which lineages should be plotted (default is to plot all lineages). If `col` is a vector, it will be subsetted by `linInd`.
`show.constraints` | logical, whether or not the user-specified initial and terminal clusters should be specially denoted by green and red dots, respectively.
`add` | logical, indicates whether the output should be added to an existing plot.
`dims` | numeric, which dimensions to plot (default is `1:2`).
`asp` | numeric, the y/x aspect ratio, see `plot.window`.
`cex` | numeric, amount by which points should be magnified, see `par`.
`lwd` | numeric, the line width, see `par`.
`col` | character or numeric, color(s) for lines, see `par`.
`...` | additional parameters to be passed to `lines`.

### Details

If `type == 'lineages'`, straight line connectors between cluster centers will be plotted. If `type == 'curves'`, simultaneous principal curves will be plotted.

When `type` is not specified, the function will first check the `curves` slot and plot the curves, if present. Otherwise, `lineages` will be plotted, if present.

### Value

returns `NULL`.

### Examples

    data("slingshotExample")
    rd <- slingshotExample$rd
    cl <- slingshotExample$cl
    pto <- slingshot(rd, cl, start.clus = "1")
    plot(SlingshotDataSet(pto), type = 'b')

    # add to existing plot
    sds <- as.SlingshotDataSet(pto)
    plot(rd, col = 'grey50', asp = 1)
    lines(sds, lwd = 3)

[Package slingshot version 2.2.1 Index]