View source: R/plotExplanatoryPCs.R

plotExplanatoryPCs | R Documentation |

Plot the explanatory PCs for each variable

```
plotExplanatoryPCs(
object,
nvars_to_plot = 10,
npcs_to_plot = 50,
theme_size = 10,
...
)
```

`object` |
A SingleCellExperiment object containing expression values and experimental information.
Alternatively, a matrix containing the output of |

`nvars_to_plot` |
Integer scalar specifying the number of variables with the greatest explanatory power to plot.
This can be set to |

`npcs_to_plot` |
Integer scalar specifying the number of PCs to plot. |

`theme_size` |
numeric scalar providing base font size for ggplot theme. |

`...` |
Parameters to be passed to |

A density plot is created for each variable, showing the R-squared for each successive PC (up to `npcs_to_plot`

PCs).
Only the `nvars_to_plot`

variables with the largest maximum R-squared across PCs are shown.

If `object`

is a SingleCellExperiment object, `getExplanatoryPCs`

will be called to compute the variance in expression explained by each variable in each gene.
Users may prefer to run `getExplanatoryPCs`

manually and pass the resulting matrix as `object`

, in which case the R-squared values are used directly.

A ggplot object.

```
example_sce <- mockSCE()
example_sce <- logNormCounts(example_sce)
example_sce <- runPCA(example_sce)
plotExplanatoryPCs(example_sce)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.