Description Usage Arguments Value Note Author(s) Examples
View source: R/compareTaxaGroups.R
Plot Multiple Graphs with Shared Legend in a Grid
1 2 |
... |
Plots to be arranged in grid |
ncol |
Number of columns in grid |
nrow |
Number of rows in grid |
position |
Gird position (bottom or right) |
title |
Title of grid |
titleSize |
Size of grid title |
Grid of plots with common legend
adapted from https://rdrr.io/github/PhilBoileau/CLSAR/src/R/ gridArrangeSharedLegend.R
Phil Boileau, philippe.boileau (at) rimuhc.ca
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | data("mainLongRaw", package="PhyloProfile")
data <- mainLongRaw
inGroup <- c("ncbi9606", "ncbi10116")
varNames <- colnames(data)[c(4, 5)]
plotDf <- dataVarDistTaxGroup(data, inGroup, "101621at6656", varNames)
plotParameters <- list(
"xSize" = 12,
"ySize" = 12,
"titleSize" = 15,
"legendSize" = 12,
"legendPosition" = "right",
"mValue" = "mean",
"inGroupName" = "In-group",
"outGroupName" = "Out-group",
"title" = "101621at6656"
)
plotVar1 <- generateSinglePlot(plotDf, plotParameters, colnames(plotDf)[1])
plotVar2 <- generateSinglePlot(plotDf, plotParameters, colnames(plotDf)[2])
g <- gridArrangeSharedLegend(
plotVar1, plotVar2,
position = plotParameters$legendPosition,
title = plotParameters$title,
size = plotParameters$titleSize
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.