Skip to content
FlowScript templates

Figure — four-panel results figure for a trial

A journal-ready four-panel results figure at 180 mm — survival curves, a raincloud, an ROC curve and an updated meta-analysis — composed from four live views and lettered a to d, aligned on their plot areas. Typed FlowScript for 2-D figure composition. Keywords: figure, schematic, diagram, annotation.

Template previewFlowScript
Heart-failure hospitalisation or cardiovascular deathFigure: Heart-failure hospitalisation or cardiovascular death. Kaplan-Meier survival plot. Horizontal axis: Time (months), linear scale, from 0 to 25. Vertical axis: Survival probability (probability), linear scale, from 0 to 1. 2 series. Remote monitoring (12.7 months, n = 50); Usual care (7.45 months, interval 4.1 to 11.1, n = 50). Observations: n = 100 subjects. Uncertainty: no uncertainty is shown. Comparison: Remote monitoring is higher than Usual care (log-rank test (Mantel 1966); p = 0.022). Estimator: Kaplan–Meier product-limit, 95% level (band not drawn). Test: log-rank (Mantel 1966), chi-square 5.27 on 1 degree(s) of freedom, P = 0.022, over 54 event times and arms Remote monitoring versus Usual care. Remote monitoring: n = 50, 27 events, 23 censored, median 12.7 months (95% CI 10.9 to not reached). Usual care: n = 50, 36 events, 14 censored, median 7.4 months (95% CI 4.1 to 11.1). Numbers at risk, Remote monitoring: 0: 50; 5: 42; 10: 31; 15: 17; 20: 10; 25: 0. Numbers at risk, Usual care: 0: 50; 5: 30; 10: 22; 15: 11; 20: 3; 25: 0.Heart-failure hospitalisation or cardiovascular deathRemote monitoring (n = 50, 27 events)Remote monitoring: 23 censoredUsual care (n = 50, 36 events)Usual care: 14 censored0.000.250.500.751.00Survival probability0510152025Time (months)Log-rank χ² = 5.27 (1 df), P = 0.022Remote monitoring: median 12.7 months (95% CI 10.9 to not reached)Usual care: median 7.4 months (95% CI 4.1 to 11.1)Remote monitoringUsual careNumber at riskRemote monitoring50423117100Usual care5030221130Kaplan–Meier product-limit estimate. Confidence band not drawn.Numbers at risk are the subjects still under observation at each time-axis tick; a subject observed at exactly a tick is counted as at risk there.Ticks on the curves mark follow-up ending without the event (censoring).1 palette colour(s) darkened or lightened to clear 3:1 against the panel; each arm also carries its own dash pattern, so the figure survives greyscale.

Make it your own.

// A journal-ready four-panel results figure at 180 mm — survival curves, a raincloud, an ROC curve and an updated meta-analysis — composed from four live views and lettered a to d, aligned on their plot areas.
//
// Every string below is EXAMPLE text from a fictional trial: replace it.
//
// Each panel is an ordinary view of this document, drawn from its own
// data, so every statistic in the plate is computed rather than pasted:
//   (a) time to first heart-failure hospitalisation or cardiovascular
//       death, one follow-up time and 0/1 event flag per patient;
//   (b) change in six-minute walk distance at 12 weeks, one value per
//       patient with a complete walk test at both visits;
//   (c) baseline NT-proBNP against hospitalisation within 6 months;
//   (d) this trial pooled with five earlier trials. Its own row is the
//       Cox hazard ratio fitted to the patients in panel (a) — 0.56 (0.34
//       to 0.93) — so the two panels cannot disagree.
//
// The container panel sets the plate (a 3 × 2 grid at 180 mm, a double
// column for most journals); each child panel names one view and its
// cell, and the two wide figures span both columns. Edit
// any view's data and its panel redraws in place. A child view that fails
// to draw becomes a labelled placeholder rather than breaking the plate.

survival primary_endpoint {
  title: "Heart-failure hospitalisation or cardiovascular death"
  time_unit: "months"
  risk_table: true
  censor_marks: true
  group remote_arm {
    label: "Remote monitoring"
    times: [
      12.7, 23.9, 12.2, 0.7, 10.9, 14.9, 2.2, 16.7, 7.4, 4.8, 9.6, 15.3, 16, 20.4, 14.3,
      21.9, 6.3, 11.9, 2.7, 5.8, 8.2, 18.4, 12.6, 6.3, 15.4, 6.1, 0.5, 21.9, 16.9, 13.1,
      3.4, 11.5, 12.4, 14.4, 2.4, 22.2, 15, 5, 4.2, 8.5, 22, 12.2, 11.4, 23.4, 8.5,
      23.7, 9.4, 21.8, 13.4, 21.9
    ]
    events: [
      1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0,
      1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0
    ]
  }
  group usual_arm {
    label: "Usual care"
    times: [
      20.7, 10.5, 3.1, 3.8, 2.7, 2.8, 13.2, 0.4, 9.9, 18.5, 0.2, 15.8, 3.2, 6.8, 10.1,
      18.2, 18, 13.2, 18.1, 9.7, 19.6, 1.6, 1.9, 7.3, 6.7, 21.6, 2, 13.4, 14.8, 4.8,
      4.7, 11.4, 5.2, 10.7, 0.5, 12.3, 12.1, 7.6, 11.1, 16.1, 4.1, 2, 1, 1.6, 6.5,
      1.7, 0.9, 16.7, 1.8, 22.5
    ]
    events: [
      0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1,
      0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0
    ]
  }
}

distribution walk_change {
  title: "Change in six-minute walk distance at 12 weeks"
  label: "Change from baseline"
  unit: "m"
  kind: raincloud
  group walk_remote {
    label: "Remote monitoring"
    values: [
      61, 21, 102, 137, 11, 93, 29, 65, 43, 31, 41, 47, 28, 105, -33, 10, 41, 10, 45, 11,
      25, 33, 43, 67, -33, 32, 26, 12, 37, 14, 56, 66, -8, 8, 60, 67, -4, 72, 39, -31
    ]
  }
  group walk_usual {
    label: "Usual care"
    values: [
      31, 77, -13, 38, -45, 93, -9, 34, 15, -3, 61, 25, 78, 63, -12, -19, -70, 25, -36, -5,
      13, 96, -44, 30, 2, -7, 6, 17, 16, 51, 26, 33, 66, 32, -2, 28, 7, 2, -2, 72
    ]
  }
}

roc bnp_roc {
  title: "Baseline NT-proBNP and hospitalisation within 6 months"
  validation: apparent
  n: 100
  events: 30
  series bnp_scores {
    label: "NT-proBNP, pg/mL"
    x: [
      2950, 130, 1080, 2760, 4420, 1400, 3150, 810, 520, 1210, 2960, 1810, 1960, 2110, 2980, 920, 720, 2070, 1930, 660,
      1170, 1360, 1060, 1950, 1680, 1780, 2830, 900, 1400, 5880, 1030, 5130, 710, 1280, 590, 1500, 5930, 1650, 870, 1680,
      1640, 1240, 3020, 320, 970, 3840, 640, 610, 710, 570, 1270, 1320, 1530, 2090, 450, 1580, 630, 2190, 790, 820,
      790, 480, 840, 990, 1570, 1000, 2220, 650, 1540, 910, 2710, 1340, 2830, 900, 930, 1580, 550, 12900, 3300, 3080,
      3830, 550, 2270, 2210, 3020, 560, 5100, 10940, 940, 810, 270, 4560, 370, 1560, 580, 390, 2370, 2880, 400, 3200
    ]
    y: [
      0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0,
      0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0,
      1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,
      0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1
    ]
  }
}

meta updated_meta {
  title: "Updated meta-analysis: remote monitoring in heart failure"
  measure: hr
  scale: log
  model: hksj
  estimate aldous_2016 { label: "Aldous 2016" point: 0.88 lo: 0.70 hi: 1.10 n: 1120 }
  estimate brandt_2018 { label: "Brandt 2018" point: 0.79 lo: 0.61 hi: 1.02 n: 860 }
  estimate castell_2019 { label: "Castell 2019" point: 0.95 lo: 0.72 hi: 1.25 n: 710 }
  estimate dumont_2021 { label: "Dumont 2021" point: 0.71 lo: 0.52 hi: 0.97 n: 540 }
  estimate eze_2023 { label: "Eze 2023" point: 0.84 lo: 0.63 hi: 1.12 n: 650 }
  estimate this_trial { label: "This trial" point: 0.56 lo: 0.34 hi: 0.93 n: 100 }
}

view survival_curves: km(primary_endpoint)
view walk_distance: raincloud(walk_change)
view biomarker_roc: roc(bnp_roc)
view meta_forest: forest(updated_meta)

panel figure_2 {
  title: "Figure 2. Primary outcome, functional capacity, prognostic biomarker and the trial in context"
  rows: 3
  cols: 2
  width: 180 mm
  label_style: lowercase-bold
}
panel panel_a {
  view: survival_curves
  row: 1
  col: 1
  col_span: 2
  caption: "Kaplan–Meier estimates of time to first heart-failure hospitalisation or cardiovascular death, with numbers at risk"
}
panel panel_b {
  view: walk_distance
  row: 2
  col: 1
  caption: "Change in six-minute walk distance at 12 weeks; every patient is shown"
}
panel panel_c {
  view: biomarker_roc
  row: 2
  col: 2
  caption: "Discrimination of baseline NT-proBNP for hospitalisation within 6 months (apparent, not validated)"
}
panel panel_d {
  view: meta_forest
  row: 3
  col: 1
  col_span: 2
  caption: "Random-effects meta-analysis of this trial with five earlier trials (Hartung–Knapp–Sidik–Jonkman interval)"
}

view figure: panel(figure_2)