Learn R Programming

grobblR (version 0.2.2)

view_grob: View Grob

Description

View an grob outputted by one of the grob_ functions with a given width and height.

Usage

view_grob(grob, height = NA_real_, width = NA_real_)

Arguments

grob

An object outputted by one of the following functions:

  • grob_matrix

  • grob_image

  • grob_row

  • grob_col

  • grob_layout

height

The numeric height in millimeters the user wishes to view the grob in.

width

The numeric width in millimeters the user wishes to view the grob in.

Details

Plotted with gridExtra::grid.arrange().

Examples

Run this code

df = data.frame(
  x = c(15, 4, 16, 11),
  y = c(10, 30, 3, 10)
  ) 
  
df %>%
  grob_matrix() %>%
  view_grob()
  
gg = ggplot2::ggplot(data = df, mapping = ggplot2::aes(x = x, y = y)) +
  ggplot2::geom_line(color = 'red')
  
gg %>%
  grob_image() %>%
  view_grob()

Run the code above in your browser using DataLab