gridArrangeSharedLegend {PhyloProfile} | R Documentation

## Plot Multiple Graphs with Shared Legend in a Grid

### Description

Plot Multiple Graphs with Shared Legend in a Grid

### Usage

    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

    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
    )

[Package PhyloProfile version 1.0.7 Index]