axis_table: Adds a table to a ggplot axis.

Description Usage Arguments Details Value

View source: R/axis_table.R

Description

axis_table

Usage

1
2
3
4
5
6
7
axis_table(
  .data,
  x = NULL,
  y = NULL,
  selected_cols = colnames(.data),
  col_widths = NULL
)

Arguments

.data

Data containing both the y aesthetic of the original data, as well as the columns which should be included in the table.

x

A character vector containing the same column as is used for the x aesthetic in the plot (use only one of x and y).

y

A character vector containing the same column as is used for the y aesthetic in the plot (use only one of x and y)

selected_cols

A character vector containing the columns in .data to be used in the axis table.

col_widths

A numeric vector containing the desired widths (in characters) of each column.

Details

Make sure you add + theme(axis.text.x = element_text(family = "mono", color = "black", hjust=0))

to the plot if you're adding a table to y axis or + theme(axis.text.y = element_text(family = "mono", color = "black", angle=-90, vjust=0))

for the x axis. This will ensure your table is oriented correctly and that a fixed-width font is used.

Value

A specially-formed scale_discrete function containing the table to be added to the plot.


nicokist/ggaxistable documentation built on June 3, 2021, 9:57 a.m.