| scale_x_foresttable | R Documentation |
scale_x_foresttable() constructs a continuous x scale designed for use with
geom_foresttable(). It places table column headers on the top axis tick
labels, sets appropriate breaks and limits based on the requested columns,
and ensures consistent spacing so that table panels align cleanly with forest
plots when composed using patchwork.
scale_x_foresttable(
cols,
col_labels = NULL,
col_gap = 1,
position = "top",
expand = ggplot2::expansion(mult = c(0, 0)),
limits = NULL,
...
)
cols |
Character vector of column names corresponding to the table columns. Determines the number, order, and spacing of x-axis breaks. |
col_labels |
Optional character vector giving display labels for each
column. If unnamed, must be the same length as |
col_gap |
Numeric. Spacing between adjacent columns on the x axis. |
position |
Character. Position of the x axis; defaults to |
expand |
Expansion applied to the x scale. Defaults to no expansion
( |
limits |
Optional numeric vector of length 2 giving explicit x-axis
limits. If |
... |
Additional arguments passed to |
The scale uses numeric x positions internally (one per column), which allows precise control over column spacing and alignment.
This scale is typically paired with geom_foresttable() and a void theme
(theme_void()) to create a table-like panel whose headers are rendered as
axis labels. Because headers are true axis labels, ggplot2 can align the table
panel perfectly with a forest plot panel when combining plots.
A ggplot2 scale object suitable for addition to a plot.
geom_foresttable(), gg_forest()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.