add_aesthetic: Add an Aesthetic

Description Usage Arguments Details Value Examples

View source: R/aesthetics.R

Description

Add an aesthetic to a grob matrix object.

Usage

1
2
3
4
5
6
add_aesthetic(
  grob_object,
  aesthetic,
  value = NULL,
  group = c("cells", "column_names", "column_headings")
)

Arguments

grob_object

The R6 object outputted by either grob_matrix or grob_text.

aesthetic

The matrix aesthetic the user wishes to add.

value

A single value or a matrix of values the user wants to apply to the group of matrix / text elements for the given aesthetic.

If a matrix of values is supplied, then the matrix must be of the same dimensions as the chosen subset of the matrix / text.

group

The group of the grob matrix object the user wants to add the aesthetic to.

For objects initialized by grob_matrix, the user can add an aesthetic to the 'cells', the 'column_names' or the 'column_headings'. If the user is passing through an object initialized by grob_text, then only 'cells' will be accepted.

Details

Accepted aesthetics:

Matrix / Text
  • background_alpha

  • background_color

  • border_color

  • border_sides

  • border_width

  • font_face

  • group_elements

  • replace_na

  • round_rect_radius

  • text_align

  • text_cex

  • text_font

  • text_color

  • text_just

  • text_v_align

  • text_v_just

  • text_rot

To see descriptions of the aesthetics above, see the documentation of ga_list.

Value

The R6 object of the grob matrix class with its aesthetics properties altered.

Examples

1
2
3
4
5
df = data.frame(var1 = c(5, 14, 6, 10), var2 = c(3, 30, 17, 7))
df %>%
  grob_matrix() %>% 
  add_aesthetic(aesthetic = 'text_color', value = 'red', group = 'cells') %>%
  view_grob()

grobblR documentation built on Sept. 15, 2021, 1:07 a.m.