gridArrangeSharedLegend: Plot Multiple Graphs with Shared Legend in a Grid

Description Usage Arguments Value Note Author(s) Examples

View source: R/compareTaxaGroups.R

Description

Plot Multiple Graphs with Shared Legend in a Grid

Usage

1
2
gridArrangeSharedLegend(...,  ncol = length(list(...)), nrow = 1,
    position = c("bottom", "right"), title = NA, titleSize = 12)

Arguments

...

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

Value

Grid of plots with common legend

Note

adapted from https://rdrr.io/github/PhilBoileau/CLSAR/src/R/ gridArrangeSharedLegend.R

Author(s)

Phil Boileau, philippe.boileau (at) rimuhc.ca

Examples

 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
)

PhyloProfile documentation built on March 27, 2021, 6:01 p.m.