Learn R Programming

gridify (version 0.7.4)

show_layout: Show the layout in a given gridify object or layout

Description

Method for showing the layout of a gridifyClass or gridifyLayout object. It prints the layout of the object, including the number of rows and columns and the heights and widths of the rows and columns in the graphics device.

Usage

show_layout(x)

# S4 method for gridifyClass show_layout(x)

# S4 method for gridifyLayout show_layout(x)

Value

An object showing the layout, including the widths and heights of all the rows and columns.

Arguments

x

A gridifyClass or gridifyLayout object.

See Also

gridify(), simple_layout(), complex_layout(), pharma_layout, pharma_layout_base(), pharma_layout_A4(), pharma_layout_letter()

Examples

Run this code
g <- gridify(
  object = ggplot2::ggplot(data = mtcars, ggplot2::aes(x = mpg, y = wt)) +
    ggplot2::geom_line(),
  layout = simple_layout()
)
show_layout(g)

g <- gridify(
  object = ggplot2::ggplot(data = mtcars, ggplot2::aes(x = mpg, y = wt)) +
    ggplot2::geom_line(),
  layout = complex_layout()
)
show_layout(g)

show_layout(simple_layout())
show_layout(complex_layout())

# Example with a custom layout

custom_layout <- gridifyLayout(
  nrow = 3L,
  ncol = 2L,
  heights = grid::unit(c(0.15, 0.7, 0.15), "npc"),
  widths = grid::unit(c(0.5, 0.5), "npc"),
  margin = grid::unit(c(t = 0.1, r = 0.1, b = 0.1, l = 0.1), units = "npc"),
  global_gpar = grid::gpar(),
  adjust_height = FALSE,
  object = gridifyObject(row = 2, col = 1),
  cells = gridifyCells(header = gridifyCell(
    row = 1,
    col = 1,
    x = 0.5,
    y = 0.5,
    hjust = 0.5,
    vjust = 0.5,
    rot = 0,
    gpar = grid::gpar()
  ), footer = gridifyCell(
    row = 2,
    col = 2,
    x = 0.5,
    y = 0.5,
    hjust = 0.5,
    vjust = 0.5,
    rot = 0,
    gpar = grid::gpar()
  ))
)

show_layout(custom_layout)

Run the code above in your browser using DataLab