gtable_legend: Build a grob containing a legend.

Description Usage Arguments Value Author(s)

View source: R/gtables.R

Description

Build a grob with a legend inside.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
gtable_legend(
  d,
  labels,
  widths,
  heights,
  fg_fun,
  fg_params,
  bg_fun = NULL,
  bg_params = NULL,
  title_x = NULL,
  title_y = NULL,
  title_label = "Title",
  title_gp = gpar(fontsize = 10),
  labels_pad = -1,
  labels_gp = gpar(fontsize = 6),
  padding = 0.3,
  size_unit = "mm",
  name = "legend",
  vp = NULL,
  orientation = c("horizontal", "vertical"),
  ...
)

Arguments

d

data.frame or matrix

labels

tick labels displayed at legend tick marks

widths

optional unit.list specifying the grob widths

heights

optional unit.list specifying the grob heights

fg_fun

grob-drawing function

fg_params

named list of params passed to fg_fun

bg_fun

grob-drawing function

bg_params

named list of params passed to bg_fun

title_x

unit specifying the x position of the title

title_y

unit specifying the x position of the title

title_label

character vector

title_gp

graphical parameters of the title

labels_pad

padding between the text labels

labels_gp

graphical parameters of the text labels

padding

numeric vector specifying the padding between adjacent cells.

size_unit

character vector defining the unit used for sizes. See grid::unit for all possible specifications

name

name of the grob

vp

optional viewport

orientation

choose 'horizontal' or 'vertical'

...

additional parameters passed to add_table_params.

Value

A gtable object.

Author(s)

Yoann Pradat


tableExtra documentation built on Oct. 29, 2021, 5:06 p.m.