multi_dittoPlot {dittoSeq} | R Documentation

## Generates multiple dittoPlots arranged into a grid.

### Description

Generates multiple dittoPlots arranged into a grid.

### Usage

    multi_dittoPlot(
      object,
      vars,
      group.by,
      color.by = group.by,
      legend.show = FALSE,
      ncol = 3,
      nrow = NULL,
      main = "var",
      ylab = NULL,
      xlab = NULL,
      OUT.List = FALSE,
      ...
    )

### Arguments

`object` | the Seurat or SingleCellExperiment object to draw from
`vars` | c("var1","var2","var3",...). A vector of gene or metadata names from which to generate the separate plots
`group.by` | String representing the name of a metadata to use for separating the cells/samples into discrete groups.
`color.by` | String representing the name of a metadata to use for setting color. Default = `group.by`.
`ncol, nrow` | Integers which set how many plots will be arranged per column or per row. Default = 3 columns aand however many rows are required. Set both to NULL to have the grid.arrange function figure out what might be most "square" on its own.
`main, ylab` | String which sets whether / how plot titles or y-axis labels should be added to each individual plot When set to `"var"`, the `vars` names alone will be used. When set to `"make"`, the default dittoPlot behavior will be observed: Equivalent to "make" for `main`, but for y-axis labels, gene vars will become "'var' expression". When set as any other string, that string will be used as the title / y-axis label for every plot. When set to `NULL`, titles / axes labels will not be added.
`xlab, legend.show, ...` | other paramters passed along to `dittoPlot`.
`OUT.List` | Logical. (Default = FALSE) When set to `TRUE`, a list of the individual plots, named by the `vars` being shown in each, is output instead of the combined multi-plot.

### Value

Given multiple 'var' parameters, this function will output a dittoPlot for each one, arranged into a grid, just with some slight tweaks to the defaults. If `OUT.list` was set to TRUE, the list of individual plots is output instead of the combined multi-plot. All parameters that can be adjusted in dittoPlot can be adjusted here.

### Author(s)

Daniel Bunis

### See Also

`dittoPlot` for the single plot version of this function

### Examples

    # dittoSeq handles bulk and single-cell data quit similarly.
    # The SingleCellExperiment object structure is used for both,
    # but all functions can be used similarly directly on Seurat
    # objects as well.

    example(importDittoBulk, echo = FALSE)
    myRNA

    genes <- getGenes(myRNA)[1:4]
    multi_dittoPlot(myRNA, genes, group.by = "clustering")

    # violin-plots in front is often better for large single-cell datasets,
    # but we cn change the order with 'plots'
    multi_dittoPlot(myRNA, genes, "clustering",
        plots = c("vlnplot","boxplot","jitter"))

    #To make it output a grid that is 2x2, to add y-axis labels
    # instead of titles, and to show legends...
    multi_dittoPlot(myRNA, genes, "clustering",
        nrow = 2, ncol = 2,           #Make grid 2x2 (only one of these needed)
        main = NULL, ylab = "make",   #Add y axis labels instead of titles
        legend.show = TRUE)           #Show legends

    # We can also facet with 'split.by'
    multi_dittoPlot(myRNA, genes, "clustering",
        split.by = "SNP")

[Package dittoSeq version 0.99.14 Index]