Demonstrations of specific tabviz features. Each example highlights one feature family.

Rich Column Types

A comprehensive showcase of column types — heatmaps, progress bars, currency, dates, badges, stars, sparklines, bars, ranges, and icons — using a project management dataset:

Code
project_data <- data.frame(
  task = c("Backend API", "Frontend UI", "Database Migration",
           "Auth System", "Deployment Pipeline", "Documentation"),
  status = c("Active", "Active", "Completed", "At Risk", "On Hold", "Active"),
  priority = c(5, 4, 3, 5, 2, 3),
  budget = c(85000, 62000, 41000, 55000, 28000, 15000),
  spent_pct = c(0.65, 0.42, 1.00, 0.88, 0.15, 0.30),
  health = c(88, 75, 100, 45, 60, 82),
  start_date = as.Date(c("2025-01-15", "2025-02-01", "2024-11-01",
                          "2025-03-10", "2025-04-01", "2025-03-15")),
  est_low = c(30, 20, 15, 25, 10, 8),
  est_high = c(45, 35, 20, 40, 18, 12),
  velocity = I(list(
    c(8, 10, 12, 14, 15, 18, 20, 22),
    c(5, 8, 10, 12, 10, 8, 12, 14),
    c(15, 18, 20, 22, 25, 28, 30, 32),
    c(12, 10, 8, 6, 5, 4, 3, 2),
    c(2, 3, 4, 3, 2, 1, 1, 0),
    c(3, 5, 6, 8, 10, 12, 14, 15)
  )),
  flag = c("ok", "ok", "done", "blocked", "paused", "ok")
)

tabviz(project_data, label = "task",
  columns = list(
    col_badge("status", "Status",
      variants = list(
        Active = "success", Completed = "info",
        `At Risk` = "error", `On Hold` = "warning"
      )),
    col_stars("priority", "Priority", max_stars = 5),
    col_currency("budget", "Budget", decimals = 0),
    col_progress("spent_pct", "Spent", max_value = 1),
    col_heatmap("health", "Health",
      palette = c("#fee2e2", "#dcfce7"),
      min_value = 0, max_value = 100, decimals = 0),
    col_date("start_date", "Started", format = "%b %Y"),
    col_range("est_low", "est_high", header = "Est. Days"),
    col_sparkline("velocity", "Velocity"),
    col_icon("flag", "Flag",
      mapping = list(ok = "\u2714", done = "\u2605", blocked = "\u2716", paused = "\u23f8"))
  ),
  theme = web_theme_modern(),
  title = "Rich Column Types Showcase"
)

Distribution Visualizations

All three visualization types — viz_bar, viz_boxplot, and viz_violin — in one combined clinical site dashboard:

Code
set.seed(654)
clinical_dashboard <- data.frame(
  site = c("Boston", "London", "Tokyo", "Sydney", "Toronto"),
  enrollment = c(245, 189, 312, 156, 198),
  completion_rate = c(0.87, 0.92, 0.78, 0.95, 0.89),
  response_times = I(list(
    rnorm(50, 5.2, 1.1),
    rnorm(50, 4.8, 0.9),
    rnorm(50, 6.1, 1.5),
    rnorm(50, 4.5, 0.8),
    rnorm(50, 5.5, 1.2)
  )),
  satisfaction = I(list(
    c(rnorm(60, 8.0, 1.0), rnorm(20, 5, 1.5)),
    rnorm(80, 8.5, 0.7),
    c(rnorm(50, 7.0, 1.5), runif(20, 3, 9)),
    rnorm(75, 9.0, 0.5),
    c(rnorm(40, 7.5, 1.2), rnorm(30, 6, 1.8))
  ))
)

tabviz(clinical_dashboard, label = "site",
  columns = list(
    viz_bar(
      effect_bar("enrollment"),
      header = "Enrolled",
      axis_range = c(0, 350)
    ),
    viz_bar(
      effect_bar("completion_rate"),
      header = "Completion",
      axis_range = c(0, 1)
    ),
    viz_boxplot(
      effect_boxplot(data = "response_times"),
      header = "Response Time (days)",
      show_outliers = TRUE
    ),
    viz_violin(
      effect_violin(data = "satisfaction"),
      header = "Satisfaction (1-10)",
      show_median = TRUE,
      show_quartiles = TRUE
    )
  ),
  theme = web_theme_modern(),
  title = "Clinical Site Performance Dashboard"
)

Column Groups & Split Plots

Combine col_group() headers with split_by for faceted views with organized columns:

Code
set.seed(789)
regional_data <- data.frame(
  study = rep(paste0("Study ", 1:4), 3),
  region = rep(c("North America", "Europe", "Asia Pacific"), each = 4),
  n = rep(c(1250, 980, 1560, 1100), 3),
  hr = c(0.72, 0.85, 0.68, 0.91,
         0.78, 0.82, 0.75, 0.88,
         0.65, 0.71, 0.62, 0.79),
  lo = c(0.55, 0.70, 0.52, 0.75,
         0.62, 0.68, 0.58, 0.72,
         0.48, 0.55, 0.45, 0.62),
  hi = c(0.95, 1.03, 0.89, 1.10,
         0.98, 0.99, 0.97, 1.08,
         0.88, 0.92, 0.86, 1.01)
)

tabviz(regional_data, label = "study",
  columns = list(
    col_group("Study Info",
      col_n("n")
    ),
    viz_forest(point = "hr", lower = "lo", upper = "hi",
               scale = "log", null_value = 1),
    col_group("Results",
      col_interval("HR (95% CI)", point = "hr", lower = "lo", upper = "hi")
    )
  ),
  split_by = "region",
  shared_axis = TRUE,
  theme = web_theme_jama(),
  title = "Treatment Effect by Region"
)

All Theme Variants

Compare all 9 built-in themes:

Code
sample_data <- data.frame(
  study = c("A", "B", "C"),
  hr = c(0.72, 0.85, 0.91),
  lo = c(0.55, 0.70, 0.75),
  hi = c(0.95, 1.03, 1.10)
)

make_plot <- function(theme_fn, name) {
  tabviz(sample_data, label = "study",
    columns = list(viz_forest(point = "hr", lower = "lo", upper = "hi",
                             scale = "log", null_value = 1)),
    theme = theme_fn(), title = name
  )
}

make_plot(web_theme_default, "Default")
make_plot(web_theme_jama, "JAMA")
make_plot(web_theme_lancet, "Lancet")
make_plot(web_theme_nature, "Nature")
make_plot(web_theme_cochrane, "Cochrane")
make_plot(web_theme_modern, "Modern")
make_plot(web_theme_presentation, "Presentation")
make_plot(web_theme_dark, "Dark")
make_plot(web_theme_minimal, "Minimal")

Conditional Styling

One comprehensive example showing formulas for row_bold, row_color, marker_shape, marker_color, and cell-level color/bold on columns:

Code
styling_data <- data.frame(
  study = c("RCT Alpha", "RCT Beta", "Cohort Gamma", "Cohort Delta",
            "Registry Epsilon", "RCT Zeta", "Cohort Eta"),
  design = c("RCT", "RCT", "Cohort", "Cohort", "Registry", "RCT", "Cohort"),
  hr = c(0.65, 0.78, 0.95, 1.12, 0.88, 0.72, 1.05),
  lo = c(0.50, 0.62, 0.78, 0.95, 0.72, 0.58, 0.88),
  hi = c(0.84, 0.98, 1.15, 1.32, 1.08, 0.89, 1.25),
  pval = c(0.001, 0.02, 0.15, 0.03, 0.08, 0.005, 0.22),
  quality = c(1.0, 0.9, 0.7, 0.6, 0.5, 0.95, 0.65)
)

tabviz(styling_data,
  label = "study",
  columns = list(
    col_text("design", "Design"),
    viz_forest(point = "hr", lower = "lo", upper = "hi",
               scale = "log", null_value = 1),
    col_numeric("hr", "HR",
      color = ~ ifelse(.x < 1, "#16a34a", "#dc2626"),
      bold = ~ .x < 0.8 | .x > 1.1
    ),
    col_pvalue("pval", "P",
      stars = TRUE,
      bold = ~ .x < 0.05
    ),
    col_badge("design", "Type")
  ),
  # Row-level styling
  row_bold = ~ pval < 0.01,
  row_color = ~ case_when(
    hi < 1 ~ "#16a34a",
    lo > 1 ~ "#dc2626",
    TRUE ~ "#64748b"
  ),
  # Marker styling by study design
  marker_shape = ~ case_when(
    design == "RCT" ~ "circle",
    design == "Cohort" ~ "square",
    TRUE ~ "diamond"
  ),
  marker_color = ~ case_when(
    hi < 1 ~ "#16a34a",
    lo > 1 ~ "#dc2626",
    TRUE ~ "#64748b"
  ),
  marker_opacity = "quality",
  marker_size = ~ ifelse(design == "RCT", 1.2, 1),
  theme = web_theme_nature(),
  title = "Conditional Styling Showcase",
  subtitle = "Row, cell, and marker styling with formulas"
)

Fluent Theme Customization

Demonstrate set_* modifier chaining to build a fully customized theme from a base:

Code
custom_theme <- web_theme_default() |>
  set_colors(
    background = "#fefce8",
    foreground = "#422006",
    primary = "#ca8a04",
    border = "#e5e7eb",
    interval_positive = "#16a34a",
    interval_negative = "#dc2626",
    interval_neutral = "#64748b"
  ) |>
  set_typography(
    font_family = "Georgia, serif",
    font_size_base = "0.8125rem",
    font_weight_bold = 700
  ) |>
  set_spacing(
    row_height = 32,
    cell_padding_x = 12,
    column_gap = 8
  ) |>
  set_shapes(
    point_size = 8,
    line_width = 2,
    border_radius = 6
  ) |>
  set_layout(
    banding = TRUE,
    container_border_radius = 8
  )

theme_data <- data.frame(
  study = c("PIONEER-1", "SUMMIT-2", "HORIZON-3", "ELEVATE-4", "APEX-5"),
  n = c(2450, 1890, 3200, 1560, 2100),
  hr = c(0.72, 0.85, 0.68, 0.91, 0.78),
  lo = c(0.58, 0.70, 0.52, 0.75, 0.62),
  hi = c(0.89, 1.03, 0.89, 1.10, 0.98),
  status = c("Significant", "Non-significant", "Significant",
             "Non-significant", "Significant")
)

tabviz(theme_data,
  label = "study",
  columns = list(
    col_n("n"),
    viz_forest(point = "hr", lower = "lo", upper = "hi",
               scale = "log", null_value = 1,
               axis_label = "Hazard Ratio"),
    col_interval("HR (95% CI)", point = "hr", lower = "lo", upper = "hi"),
    col_badge("status", "Result",
      variants = list(
        Significant = "success",
        `Non-significant` = "warning"
      ))
  ),
  marker_color = ~ ifelse(hi < 1, "#16a34a", "#64748b"),
  theme = custom_theme,
  title = "Custom Warm Theme via set_* Chaining",
  subtitle = "Built from web_theme_default() with piped modifiers"
)
TipAvailable Modifiers

The full set of set_* functions: set_colors(), set_typography(), set_spacing(), set_shapes(), set_layout(), set_axis(), set_group_headers(), set_effect_colors(), set_marker_shapes(). See Fluent API for full documentation.