Gallery: Advanced Examples

Multi-feature combinations, publication templates, and specialized visualizations.

Combo Showcases

Multiple features working together.

11. Clinical Trial Program

Nested groups + multiple effects + sparklines + badges.

Code
set.seed(2024)
trial_program <- tibble(
  site = c(
    "MGH Boston", "UCSF", "Mayo Clinic",
    "Oxford", "Charite", "Karolinska",
    "Tokyo Univ", "Singapore GH", "Melbourne"
  ),
  region = c(rep("americas", 3), rep("europe", 3), rep("asia_pacific", 3)),
  country = c("usa", "usa", "usa", "uk", "germany", "sweden", "japan", "singapore", "australia"),
  itt_hr = c(0.68, 0.72, 0.75, 0.78, 0.71, 0.82, 0.65, 0.69, 0.74),
  itt_lo = c(0.52, 0.56, 0.60, 0.62, 0.55, 0.66, 0.49, 0.53, 0.58),
  itt_hi = c(0.89, 0.93, 0.94, 0.98, 0.92, 1.02, 0.86, 0.90, 0.95),
  pp_hr = c(0.64, 0.68, 0.71, 0.74, 0.67, 0.78, 0.61, 0.65, 0.70),
  pp_lo = c(0.48, 0.52, 0.55, 0.58, 0.51, 0.62, 0.45, 0.49, 0.54),
  pp_hi = c(0.85, 0.89, 0.92, 0.94, 0.88, 0.98, 0.83, 0.86, 0.91),
  n = c(1250, 980, 1420, 890, 1100, 760, 1850, 1340, 1180),
  trend = list(
    c(0.85, 0.78, 0.72, 0.68, 0.67), c(0.88, 0.82, 0.76, 0.72, 0.71),
    c(0.90, 0.85, 0.80, 0.76, 0.75), c(0.92, 0.88, 0.84, 0.79, 0.78),
    c(0.86, 0.80, 0.75, 0.71, 0.70), c(0.94, 0.90, 0.86, 0.83, 0.82),
    c(0.82, 0.75, 0.70, 0.66, 0.65), c(0.85, 0.78, 0.73, 0.69, 0.68),
    c(0.88, 0.82, 0.78, 0.74, 0.73)
  ),
  badge = c("Lead Site", NA, NA, NA, NA, NA, "Top Recruiter", NA, NA)
)

tabviz(
  trial_program,
  label = "site", group = c("region", "country"),
  columns = list(
    col_n("n"),
    col_sparkline("trend", "HR Trend"),
    viz_forest(
      effects = list(
        effect_forest("itt_hr", "itt_lo", "itt_hi", label = "ITT", color = "#2563eb"),
        effect_forest("pp_hr", "pp_lo", "pp_hi", label = "Per-Protocol", color = "#16a34a")
      ),
      scale = "log", null_value = 1,
      axis_label = "Hazard Ratio"
    ),
    col_interval(point = "itt_hr", lower = "itt_lo", upper = "itt_hi", header = "ITT HR (95% CI)")
  ),
  row_badge = "badge",
  theme = web_theme_dark(),
  title = "Clinical Trial Program",
  subtitle = "Nested groups + dual effects + sparklines + badges",
  caption = "Combining hierarchical structure with sensitivity analysis"
)

12. Executive Dashboard

Table-only + bars + sparklines + row styling.

Code
exec_dashboard <- tibble(
  department = c(
    "COMPANY TOTAL", "",
    "Engineering", "  Platform", "  Infrastructure", "  Mobile",
    "",
    "Product", "  Design", "  Research",
    "",
    "Sales", "  Enterprise", "  SMB"
  ),
  headcount = c(1250, NA, 480, 180, 150, 150, NA, 220, 85, 135, NA, 550, 320, 230),
  revenue_m = c(185, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 185, 142, 43),
  growth = c(24, NA, 32, 45, 28, 18, NA, 28, 35, 22, NA, 18, 22, 12),
  satisfaction = c(78, NA, 82, 85, 80, 81, NA, 76, 79, 74, NA, 75, 77, 72),
  trend = list(
    c(1050, 1100, 1150, 1180, 1220, 1250), NULL,
    c(380, 400, 420, 440, 460, 480), c(140, 150, 160, 170, 175, 180),
    c(120, 130, 140, 145, 148, 150), c(120, 120, 125, 130, 140, 150), NULL,
    c(180, 190, 200, 208, 215, 220), c(65, 70, 75, 80, 82, 85),
    c(115, 120, 125, 128, 132, 135), NULL,
    c(490, 505, 520, 532, 542, 550), c(280, 290, 300, 308, 315, 320),
    c(210, 215, 220, 224, 227, 230)
  ),
  effect = rep(1, 14), lower = rep(0.9, 14), upper = rep(1.1, 14),
  rtype = c("summary", "spacer", "header", rep("data", 3), "spacer",
            "header", "data", "data", "spacer", "header", "data", "data"),
  rbold = c(TRUE, FALSE, TRUE, rep(FALSE, 3), FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE),
  rindent = c(0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1),
  rcolor = c("#16a34a", NA, "#2563eb", NA, NA, NA, NA, "#2563eb", NA, NA, NA, "#2563eb", NA, NA)
)

tabviz(
  exec_dashboard,
  label = "department",
  columns = list(
    col_numeric("headcount", "HC"),
    col_numeric("revenue_m", "Rev $M"),
    col_bar("growth", "Growth %"),
    col_numeric("satisfaction", "eNPS"),
    col_sparkline("trend", "6M Trend")
  ),
  row_type = "rtype", row_bold = "rbold", row_indent = "rindent", row_color = "rcolor",
  theme = web_theme_modern(),
  title = "Executive Dashboard",
  subtitle = "Table-only with hierarchical org structure",
  caption = "Using tabviz() with row styling for org charts"
)

13. Publication Meta-Analysis

Row styling + annotations + axis control using the glp1_trials package dataset.

Code
data(glp1_trials)

tabviz(
  glp1_trials,
  label = "study",
  group = "group",
  columns = list(
    col_group("Study Info",
      col_text("drug", "Drug"),
      col_n("n")
    ),
    viz_forest(point = "hr", lower = "lower", upper = "upper",
               scale = "log", null_value = 1,
               axis_range = c(0.4, 1.5),
               axis_ticks = c(0.5, 0.75, 1.0, 1.25),
               axis_gridlines = TRUE,
               axis_label = "Hazard Ratio (95% CI)",
               annotations = list(
                 refline(0.85, label = "Pooled HR", style = "dashed", color = "#00407a")
               )),
    col_group("Results",
      col_events("events", "n", "Events"),
      col_interval(point = "hr", lower = "lower", upper = "upper", header = "HR (95% CI)"),
      col_pvalue("pvalue", "P")
    )
  ),
  row_type = "row_type", row_bold = "row_bold",
  theme = web_theme_lancet(),
  title = "GLP-1 Agonist Cardiovascular Outcomes",
  subtitle = "Row grouping by trial type + column grouping for Study Info / Results",
  caption = "Major adverse cardiovascular events (MACE)",
  footnote = "See ?glp1_trials for data documentation"
)

14. The Full Monty

Everything at once. Maximum feature density.

Code
full_monty <- tibble(
  study = c(
    "ALPHA-01", "ALPHA-02",
    "BETA-01", "BETA-02", "BETA-03",
    "GAMMA-01", "GAMMA-02"
  ),
  program = c(rep("program_a", 2), rep("program_b", 3), rep("program_c", 2)),
  phase = c("Phase_II", "Phase_II", "Phase_III", "Phase_III", "Phase_III", "Phase_II", "Phase_III"),
  # Three effects
  primary_hr = c(0.68, 0.72, 0.65, 0.71, 0.74, 0.78, 0.69),
  primary_lo = c(0.52, 0.56, 0.50, 0.55, 0.58, 0.62, 0.53),
  primary_hi = c(0.89, 0.93, 0.85, 0.92, 0.95, 0.98, 0.90),
  secondary_hr = c(0.72, 0.76, 0.69, 0.75, 0.78, 0.82, 0.73),
  secondary_lo = c(0.56, 0.60, 0.53, 0.59, 0.62, 0.66, 0.57),
  secondary_hi = c(0.93, 0.96, 0.90, 0.95, 0.98, 1.02, 0.94),
  safety_hr = c(0.85, 0.88, 0.82, 0.86, 0.89, 0.92, 0.84),
  safety_lo = c(0.68, 0.72, 0.65, 0.69, 0.72, 0.75, 0.67),
  safety_hi = c(1.06, 1.08, 1.04, 1.07, 1.10, 1.13, 1.05),
  n = c(420, 380, 1250, 980, 1100, 560, 890),
  weight = c(8, 7, 22, 18, 20, 10, 15),
  pvalue = c(0.008, 0.015, 0.001, 0.004, 0.012, 0.042, 0.003),
  trend = list(
    c(0.85, 0.78, 0.72, 0.68), c(0.88, 0.82, 0.76, 0.72),
    c(0.82, 0.75, 0.69, 0.65), c(0.86, 0.80, 0.75, 0.71),
    c(0.88, 0.82, 0.78, 0.74), c(0.92, 0.88, 0.84, 0.78),
    c(0.84, 0.78, 0.73, 0.69)
  ),
  badge = c("Lead", NA, "Pivotal", NA, NA, NA, "Fast Track")
)

# Custom theme
monty_theme <- web_theme_dark() |>
  set_colors(primary = "#f59e0b", interval_positive = "#22c55e", interval_negative = "#ef4444") |>
  set_spacing(row_height = 38) |>
  set_axis(gridlines = TRUE, gridline_style = "dotted")

tabviz(
  full_monty,
  label = "study", group = c("program", "phase"),
  columns = list(
    col_n("n"),
    col_bar("weight"),
    viz_forest(
      effects = list(
        effect_forest("primary_hr", "primary_lo", "primary_hi", label = "Primary", color = "#22c55e"),
        effect_forest("secondary_hr", "secondary_lo", "secondary_hi", label = "Secondary", color = "#3b82f6"),
        effect_forest("safety_hr", "safety_lo", "safety_hi", label = "Safety", color = "#f59e0b")
      ),
      scale = "log", null_value = 1,
      axis_range = c(0.4, 1.2),
      axis_label = "Hazard Ratio",
      annotations = list(
        refline(0.75, label = "Target", style = "dashed", color = "#a855f7")
      )
    ),
    col_group("Results",
      col_interval(point = "primary_hr", lower = "primary_lo", upper = "primary_hi", header = "HR (95% CI)"),
      col_pvalue("pvalue", "P")
    ),
    col_sparkline("trend", "Trend")
  ),
  row_badge = "badge",
  theme = monty_theme,
  title = "The Full Monty",
  subtitle = "Nested groups + 3 effects + sparklines + weights + annotations + custom theme",
  caption = "Every major feature combined in one visualization",
  footnote = "Green=Primary, Blue=Secondary, Orange=Safety. Purple line=Target."
)

Publication Templates

Clean, professional examples for different contexts.

15. JAMA Style

Dense, minimal, black and white. Interaction p-values for subgroups.

Code
jama_data <- tibble(
  subgroup = c(
    "Overall",
    "",
    "Age",
    "  <65 years", "  >=65 years",
    "",
    "Sex",
    "  Male", "  Female",
    "",
    "Baseline risk",
    "  Low", "  Intermediate", "  High"
  ),
  hr = c(0.76, NA, NA, 0.72, 0.82, NA, NA, 0.74, 0.79, NA, NA, 0.85, 0.75, 0.68),
  lower = c(0.68, NA, NA, 0.62, 0.70, NA, NA, 0.64, 0.67, NA, NA, 0.72, 0.63, 0.54),
  upper = c(0.85, NA, NA, 0.84, 0.96, NA, NA, 0.86, 0.93, NA, NA, 1.00, 0.89, 0.86),
  n = c(8500, NA, NA, 4200, 4300, NA, NA, 5200, 3300, NA, NA, 2800, 3400, 2300),
  p_int = c(NA, NA, NA, NA, 0.18, NA, NA, NA, 0.42, NA, NA, NA, NA, 0.03),
  rtype = c("summary", "spacer", "header", "data", "data", "spacer", "header", "data", "data", "spacer", "header", "data", "data", "data"),
  rbold = c(TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE),
  rindent = c(0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1)
)

tabviz(
  jama_data,
  label = "subgroup",
  columns = list(
    col_numeric("n", "No."),
    viz_forest(point = "hr", lower = "lower", upper = "upper",
               scale = "log", null_value = 1,
               axis_label = "Hazard Ratio (95% CI)"),
    col_interval(point = "hr", lower = "lower", upper = "upper", header = "HR (95% CI)"),
    col_pvalue("p_int", "P Interaction")
  ),
  row_type = "rtype", row_bold = "rbold", row_indent = "rindent",
  theme = web_theme_jama(),
  title = "Figure 2. Subgroup Analyses",
  footnote = "HR indicates hazard ratio. P values are for interaction."
)

16. Lancet Style

Serif fonts, blue palette, with row grouping and column grouping.

Code
lancet_data <- tibble(
  outcome = c(
    "CV death or HF hospitalization",
    "Cardiovascular death",
    "HF hospitalization",
    "All-cause mortality",
    "Change in KCCQ score"
  ),
  category = c("Primary", "Components", "Components", "Secondary", "Secondary"),
  hr = c(0.74, 0.82, 0.70, 0.88, 0.85),
  lower = c(0.66, 0.72, 0.61, 0.76, 0.74),
  upper = c(0.83, 0.94, 0.81, 1.02, 0.98),
  events_tx = c(447, 156, 291, 222, NA),
  events_ctrl = c(606, 199, 407, 253, NA),
  n_tx = c(2373, 2373, 2373, 2373, 2200),
  n_ctrl = c(2371, 2371, 2371, 2371, 2180)
)

tabviz(
  lancet_data,
  label = "outcome",
  group = "category",
  columns = list(
    col_group("Treatment",
      col_n("events_tx", "Events"),
      col_n("n_tx", "N")
    ),
    col_group("Control",
      col_n("events_ctrl", "Events"),
      col_n("n_ctrl", "N")
    ),
    viz_forest(point = "hr", lower = "lower", upper = "upper",
               scale = "log", null_value = 1,
               axis_label = "Hazard Ratio (95% CI)"),
    col_interval(point = "hr", lower = "lower", upper = "upper", header = "HR (95% CI)")
  ),
  theme = web_theme_lancet(),
  title = "Figure 3: Efficacy Outcomes",
  subtitle = "Row groups by endpoint type + column groups by treatment arm",
  caption = "HR<1 favours treatment.",
  footnote = "Cox proportional hazards model stratified by region."
)

17. Minimal Print

Maximum density, pure black and white, with row and column grouping.

Code
minimal_data <- tibble(
  trial = c("ADVANCE", "CARDINAL", "ELEVATE", "FRONTIER", "GENESIS", "HORIZON"),
  phase = c("Phase III", "Phase III", "Phase III", "Phase II", "Phase II", "Phase III"),
  n = c(1680, 1520, 1890, 2100, 980, 1450),
  events = c(168, 152, 189, 210, 98, 145),
  hr = c(0.74, 0.78, 0.71, 0.82, 0.69, 0.76),
  lower = c(0.62, 0.66, 0.60, 0.71, 0.55, 0.64),
  upper = c(0.88, 0.92, 0.84, 0.95, 0.87, 0.90),
  weight = c(17.2, 16.8, 19.5, 21.2, 10.1, 15.2)
)

tabviz(
  minimal_data,
  label = "trial",
  group = "phase",
  columns = list(
    col_group("Sample",
      col_n("n"),
      col_numeric("events", "Events")
    ),
    col_group("Results",
      col_bar("weight"),
      viz_forest(point = "hr", lower = "lower", upper = "upper",
                 scale = "log", null_value = 1,
                 axis_label = "Hazard Ratio"),
      col_interval(point = "hr", lower = "lower", upper = "upper", header = "HR (95% CI)")
    )
  ),
  theme = web_theme_minimal(),
  title = "Forest Plot",
  subtitle = "Row groups by phase + column groups for Sample / Results",
  footnote = "Random-effects model. Weights from inverse variance."
)

Split Forest Plots

Navigate between subgroups using an interactive sidebar. These examples use the effect_sizes dataset which contains studies with widely varying CI widths—ideal for testing axis rendering and clipping.

18. Single-Variable Split

Split by region with shared axis to enable cross-region comparison. Extreme CIs are automatically clipped.

Code
# Use effect_sizes stress test dataset - widely varying CI widths
data(effect_sizes)

tabviz(
  effect_sizes,
  label = "study",
  split_by = "region",
  shared_axis = TRUE,
  columns = list(
    col_text("treatment", "Treatment"),
    col_n("n"),
    viz_forest(point = "hr", lower = "lower", upper = "upper",
               scale = "log", null_value = 1,
               axis_label = "Hazard Ratio (95% CI)"),
    col_interval(point = "hr", lower = "lower", upper = "upper", header = "HR (95% CI)")
  ),
  theme = web_theme_modern(),
  title = "Treatment Effect by Region",
  subtitle = "Click sidebar to navigate between regions",
  caption = "Arrows indicate CIs beyond 3× the estimate bounds"
)

19. Hierarchical Split Navigation

Two-level split: Outcome > Treatment. The sidebar expands into a tree structure.

Code
data(effect_sizes)

tabviz(
  effect_sizes,
  label = "study",
  split_by = c("outcome", "treatment"),
  columns = list(
    col_text("region", "Region"),
    col_text("phase", "Phase"),
    col_n("n"),
    viz_forest(point = "hr", lower = "lower", upper = "upper",
               scale = "log", null_value = 1,
               axis_label = "Hazard Ratio"),
    col_interval(point = "hr", lower = "lower", upper = "upper", header = "HR (95% CI)")
  ),
  theme = web_theme_modern(),
  title = "Hierarchical Subgroup Analysis",
  subtitle = "Outcome > Treatment navigation tree",
  caption = "Expand tree nodes to drill into subgroups"
)

20. Shared Axis for Comparison

When shared_axis = TRUE, all subgroups use the same axis range for visual comparison across splits.

Code
data(effect_sizes)

tabviz(
  effect_sizes,
  label = "study",
  split_by = "outcome",
  shared_axis = TRUE,
  columns = list(
    col_text("treatment", "Treatment"),
    col_text("phase", "Phase"),
    viz_forest(point = "hr", lower = "lower", upper = "upper",
               scale = "log", null_value = 1,
               axis_label = "Hazard Ratio"),
    col_interval(point = "hr", lower = "lower", upper = "upper", header = "HR (95% CI)")
  ),
  theme = web_theme_dark() |>
    set_axis(gridlines = TRUE, gridline_style = "dotted"),
  title = "Shared Axis Comparison",
  subtitle = "shared_axis = TRUE ensures consistent scale across outcomes",
  caption = "Compare Primary, Secondary, and Exploratory outcomes on identical scales"
)

Fun Examples

Non-clinical examples showcasing tabviz’s versatility.

21. NBA Player Efficiency

Sports analytics using the nba_efficiency package dataset.

Code
data(nba_efficiency)

tabviz(
  nba_efficiency,
  label = "player",
  group = "conference",
  columns = list(
    col_group("Player Info",
      col_text("team", "Team", width = 50),
      col_text("position", "Pos", width = 40)
    ),
    col_group("Stats",
      col_numeric("ppg", "PPG"),
      col_numeric("games", "GP", decimals = 0)
    ),
    viz_forest(point = "per", lower = "per_lower", upper = "per_upper",
               null_value = 15,
               axis_label = "Player Efficiency Rating"),
    col_interval(point = "per", lower = "per_lower", upper = "per_upper", header = "PER (95% CI)")
  ),
  row_badge = "award",
  theme = web_theme_modern() |>
    set_colors(
      primary = "#C9082A",  # NBA red
      interval_positive = "#17408B",  # NBA blue
      interval_negative = "#C9082A"
    ),
  title = "NBA Player Efficiency Ratings",
  subtitle = "Row groups by conference + column groups for Player Info / Stats",
  caption = "PER = 15 is league average. Badge shows major awards.",
  footnote = "Data simulated based on typical NBA statistics"
)

22. Rich Column Types

Showcasing badges, icons, stars, images, and ranges.

Code
rich_columns_data <- tibble(
  study = c("ADVANCE", "CARDINAL", "ELEVATE", "FRONTIER", "GENESIS"),
  status = c("Published", "Draft", "Published", "In Review", "Published"),
  quality = c(4, 3, 5, 4, 3),
  age_min = c(18, 21, 25, 18, 30),
  age_max = c(65, 75, 70, 80, 65),
  validated = c("yes", "no", "yes", "yes", "no"),
  doi = c("10.1001/jama.2024.1234", "10.1016/j.lancet.2024.5678",
          "10.1056/NEJMoa2024.9012", "10.1136/bmj.2024.3456",
          "10.1161/CIRCULATIONAHA.2024.7890"),
  hr = c(0.74, 0.78, 0.71, 0.82, 0.69),
  lower = c(0.62, 0.66, 0.60, 0.71, 0.55),
  upper = c(0.88, 0.92, 0.84, 0.95, 0.87)
)

tabviz(
  rich_columns_data,
  label = "study",
  columns = list(
    col_badge("status", "Status",
      variants = list(Published = "success", Draft = "warning", `In Review` = "info")
    ),
    col_stars("quality", "Quality"),
    col_range("age_min", "age_max", header = "Age"),
    col_icon("validated", "Valid",
      mapping = list(yes = "✓", no = "✗"),
      color = "#16a34a"
    ),
    col_reference("doi", "DOI", max_chars = 20),
    viz_forest(point = "hr", lower = "lower", upper = "upper",
               scale = "log", null_value = 1,
               axis_label = "Hazard Ratio"),
    col_interval(point = "hr", lower = "lower", upper = "upper", header = "HR (95% CI)")
  ),
  theme = web_theme_modern(),
  title = "Rich Column Types",
  subtitle = "Badges, stars, ranges, icons, and references",
  caption = "New column types for enhanced data presentation"
)

23. Airline Performance

Transportation analytics using the airline_delays package dataset.

Code
data(airline_delays)

# Aggregate to carrier level with carrier type
carrier_summary <- airline_delays |>
  group_by(carrier, carrier_type) |>
  summarise(
    delay_vs_avg = mean(delay_vs_avg),
    delay_lower = mean(delay_lower),
    delay_upper = mean(delay_upper),
    on_time_pct = mean(on_time_pct),
    satisfaction = mean(satisfaction),
    flights = sum(flights),
    trend = list(unlist(trend[1])),
    .groups = "drop"
  ) |>
  arrange(carrier_type, delay_vs_avg)

tabviz(
  carrier_summary,
  label = "carrier",
  group = "carrier_type",
  columns = list(
    col_group("Service",
      col_percent("on_time_pct", "On-Time", decimals = 0),
      col_numeric("satisfaction", "Rating", decimals = 1)
    ),
    col_group("Trends",
      col_sparkline("trend", "12M"),
      viz_forest(point = "delay_vs_avg", lower = "delay_lower", upper = "delay_upper",
                 null_value = 0,
                 axis_label = "Delay vs. Industry Average (minutes)"),
      col_interval(point = "delay_vs_avg", lower = "delay_lower", upper = "delay_upper", header = "Delay (min)")
    )
  ),
  theme = web_theme_modern() |>
    set_colors(
      interval_positive = "#16a34a",  # Green = good (early)
      interval_negative = "#dc2626"   # Red = bad (late)
    ),
  title = "Airline Carrier Performance",
  subtitle = "Row groups by carrier type + column groups for Service / Trends",
  caption = "Negative values = ahead of schedule",
  footnote = "Satisfaction on 1-5 scale"
)

24. Climate Change Evidence

Using climate_temps with split navigation to explore temperature anomalies across regions.

Code
data(climate_temps)

tabviz(
  climate_temps,
  label = "region",
  split_by = "category",
  shared_axis = TRUE,
  columns = list(
    col_text("period", "Period"),
    col_badge("certainty", "Confidence",
      variants = list(High = "success", Medium = "warning")
    ),
    viz_forest(point = "anomaly", lower = "lower", upper = "upper",
               null_value = 0,
               axis_label = "Temperature Anomaly (°C vs. baseline)"),
    col_interval(point = "anomaly", lower = "lower", upper = "upper", header = "Anomaly °C")
  ),
  theme = web_theme_modern() |>
    set_colors(
      interval_positive = "#dc2626",  # Red = warming
      interval_negative = "#3b82f6"   # Blue = cooling
    ) |>
    set_axis(gridlines = TRUE),
  title = "Global Temperature Change Evidence",
  subtitle = "Split by geographic category with shared axis",
  caption = "Navigate between Global, Hemisphere, and Continental measurements"
)

25. Effect Size Stress Test

The ultimate test: effect_sizes with all features enabled—hierarchical split, multiple effects, and tight CI clipping.

Code
data(effect_sizes)

# Create a secondary effect (simulated sensitivity analysis)
effect_sizes_multi <- effect_sizes |>
  mutate(
    # Sensitivity: slightly more conservative estimates
    hr_sens = hr * 1.05,
    lower_sens = lower * 1.03,
    upper_sens = upper * 1.08
  )

tabviz(
  effect_sizes_multi,
  label = "study",
  split_by = c("region", "treatment"),
  shared_axis = TRUE,
  columns = list(
    col_text("phase", "Phase"),
    col_n("n"),
    viz_forest(
      effects = list(
        effect_forest("hr", "lower", "upper", label = "Primary", color = "#2563eb"),
        effect_forest("hr_sens", "lower_sens", "upper_sens", label = "Sensitivity", color = "#f59e0b")
      ),
      scale = "log", null_value = 1,
      axis_label = "Hazard Ratio"
    ),
    col_interval(point = "hr", lower = "lower", upper = "upper", header = "HR (95% CI)")
  ),
  theme = web_theme_dark() |>
    set_axis(gridlines = TRUE, ci_clip_factor = 2) |>
    set_spacing(row_height = 36),
  title = "Comprehensive Stress Test",
  subtitle = "Region > Treatment split + dual effects + tight clipping",
  caption = "ci_clip_factor = 2 clips CIs beyond 2× the estimate bounds"
)

See Also