Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

resizePanels

Resize panels to match data scales


Description

Modify a "trellis" object so that when plotted, the panels have the specified relative width and height.

Usage

resizePanels(x, h = 1, w = 1)

Arguments

x

An object of class "trellis".

h

numeric vector specifying panel heights

w

numeric vector specifying of panel widths

Details

resizePanels modifies a "trellis" object so that when plotted, the panels have the specified relative width and height; this is only interesting when h or w are vectors with unequal entries. resizePanels can be called with no arguments, in which case the currently plotted "trellis" object (if any) is used for x, and a suitable h or w (based on the current panel layout) is chosen so that sizes are relative to the current panel ranges in the native coordinate system. This is only interesting when scales="free"; the resulting object, when plotted again, will have varying panel sizes but the same number of data units per inch in all panels.

Value

An object of class "trellis"; essentially the same as x, but with certain properties modified.

Author(s)

Deepayan Sarkar

See Also

Examples

state <- data.frame(state.x77, state.region, state.name)
state$state.name <-
    with(state, reorder(reorder(state.name, Frost),
                        as.numeric(state.region)))
dpfrost <-
    dotplot(state.name ~ Frost | reorder(state.region, Frost),
            data = state, layout = c(1, 4),
            scales = list(y = list(relation = "free")))

## approximate
resizePanels(dpfrost,
             h = with(state, table(reorder(state.region, Frost))))

## exact (including boundary padding)
resizePanels()

latticeExtra

Extra Graphical Utilities Based on Lattice

v0.6-29
GPL (>= 2)
Authors
Deepayan Sarkar <deepayan.sarkar@r-project.org>, Felix Andrews <felix@nfrac.org>
Initial release
2019-12-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.