View source: R/render_forestplot.R
| create_forest_theme | R Documentation |
Creates a forestploter theme with parameters that control overall plot sizing and appearance. This is the primary way to control how large the forest plot renders.
create_forest_theme(
base_size = 10,
scale = 1,
row_padding = NULL,
ci_pch = 15,
ci_lwd = NULL,
ci_Theight = NULL,
ci_col = "black",
header_fontsize = NULL,
body_fontsize = NULL,
footnote_fontsize = NULL,
footnote_col = "darkcyan",
title_fontsize = NULL,
cv_fontsize = NULL,
cv_col = "gray30",
refline_lwd = NULL,
refline_lty = "dashed",
refline_col = "gray30",
vertline_lwd = NULL,
vertline_lty = "dashed",
vertline_col = "gray20",
arrow_type = "closed",
arrow_col = "black",
summary_fill = "black",
summary_col = "black"
)
base_size |
Numeric. Base font size in points. This is the primary scaling parameter - increasing it will proportionally scale all fonts, row padding, and line widths. Default: 10. |
scale |
Numeric. Additional scaling multiplier applied on top of base_size. Use for quick overall scaling. Default: 1.0. |
row_padding |
Numeric vector of length 2. Padding around row content in mm as c(vertical, horizontal). If NULL, auto-calculated from base_size. Default: NULL. |
ci_pch |
Integer. Point character for CI. 15=square, 16=circle, 18=diamond. Default: 15. |
ci_lwd |
Numeric. Line width for CI lines. If NULL, auto-calculated from base_size. Default: NULL. |
ci_Theight |
Numeric. Height of T-bar ends on CI. If NULL, auto-calculated from base_size. Default: NULL. |
ci_col |
Character. Color for CI lines and points. Default: "black". |
header_fontsize |
Numeric. Font size for column headers. If NULL, auto-calculated as base_size * scale + 1. Default: NULL. |
body_fontsize |
Numeric. Font size for body text. If NULL, auto-calculated as base_size * scale. Default: NULL. |
footnote_fontsize |
Numeric. Font size for footnotes. If NULL, auto-calculated as base_size * scale - 1. Default: NULL. |
footnote_col |
Character. Color for footnote text. Default: "darkcyan". |
title_fontsize |
Numeric. Font size for title. If NULL, auto-calculated as base_size * scale + 4. Default: NULL. |
cv_fontsize |
Numeric. Font size for CV annotation text. If NULL, auto-calculated as base_size * scale. Default: NULL. |
cv_col |
Character. Color for CV annotation text. Default: "gray30". |
refline_lwd |
Numeric. Reference line width. If NULL, auto-calculated. Default: NULL. |
refline_lty |
Character. Reference line type. Default: "dashed". |
refline_col |
Character. Reference line color. Default: "gray30". |
vertline_lwd |
Numeric. Vertical line width. If NULL, auto-calculated. Default: NULL. |
vertline_lty |
Character. Vertical line type. Default: "dashed". |
vertline_col |
Character. Vertical line color. Default: "gray20". |
arrow_type |
Character. Arrow type: "open" or "closed". Default: "closed". |
arrow_col |
Character. Arrow color. Default: "black". |
summary_fill |
Character. Fill color for summary diamonds. Default: "black". |
summary_col |
Character. Border color for summary diamonds. Default: "black". |
The base_size parameter is the primary way to control plot size.
When you change base_size, the following are automatically scaled:
All font sizes (body, header, footnote, CV, title)
Row padding (vertical and horizontal)
CI line width and T-bar height
Reference and vertical line widths
The scaling formula uses base_size = 10 as the reference point:
base_size = 10: Default sizing
base_size = 12: 20% larger
base_size = 14: 40% larger
base_size = 16: 60% larger
You can override any individual parameter by specifying it explicitly.
The theme does NOT set row background colors - those are determined
automatically by plot_subgroup_results_forestplot() based on
row types (ITT, reference, posthoc, etc.).
A list of class "fs_forest_theme" containing all theme parameters.
plot_subgroup_results_forestplot, render_forestplot
## Not run:
# Simple: just increase base_size for larger plot
large_theme <- create_forest_theme(base_size = 14)
# Or use scale for quick adjustment
large_theme <- create_forest_theme(base_size = 10, scale = 1.4)
# Fine-tune specific elements
custom_theme <- create_forest_theme(
base_size = 14,
cv_fontsize = 12, # Override auto-calculated CV font size
ci_lwd = 2.5 # Override auto-calculated CI line width
)
# Use with plot_subgroup_results_forestplot
result <- plot_subgroup_results_forestplot(
fs_results = list(fs.est = fs, fs_bc = fs_bc),
df_analysis = df.analysis,
outcome.name = "time",
event.name = "status",
treat.name = "treatment",
theme = large_theme
)
render_forestplot(result)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.