DumbGrid: A not-so-smart plot arranger

View source: R/DumbGrid.R

DumbGridR Documentation

A not-so-smart plot arranger

Description

This function is a wrapper for plot_grid that removes unnecessary axis labels for plots that are not along the left side of the plot. While it was initially intended to incorporate a "smart-adjust" feature that would scale all plots without y-axis labels to be the same width as the plot areas with y-axis labels, this function requires manual resizing of the furthest-left column of plots to make them the same size as the others, hence the name DumbGrid rather than SmartGrid.

Usage

DumbGrid(..., Ncols, FirstColWidth = 1, SharedLegend = F)

Arguments

...

Unquoted object names of ggplot objects to be included in the resultant grid of plots.

Ncols

A number indicating the number of columns that should be used in the plot grid.

FirstColWidth

A number indicating the relative width of the first column of plots compared to all other columns. A value of 1 sets the left-most column at the same width as all others.

SharedLegend

A logical value indicating whether plots should share a legend (T), or have their own legend (F).

Value

This function produces a grid of plots constructed from the plots supplied to the ... argument. Plots that are not in the left-most columns will not have y-axis labels.

Examples

data("Epfu_Nb2_Long", package = "EcoCountHelper")
EffectsPlotter(Epfu_Nb2_Long, c(":)", "!", "argument", "FirstColWidth",
                           "the", "with", "adjusted", "be", "to",
                           "need", "plots", "These"))
                           
ExPlot <- Epfu_Nb2_LongEffectsPlot

#First grid attempt

TestGrid <- DumbGrid(ExPlot, ExPlot, ExPlot, ExPlot,
                      Ncols = 2)
TestGrid #View the plot in a separate window

#Adjusting the first column width to make plot sizes equal

TestGrid2 <- DumbGrid(ExPlot, ExPlot, ExPlot, ExPlot,
                       Ncols = 2, FirstColWidth = 1.35)
TestGrid2 #View the plot in a separate window


huntercole25/EcoCountHelper documentation built on Jan. 14, 2023, 4:13 a.m.