Skip to content
Plotly templates

Kaplan-Meier + Risk Table

Survival curves for two arms with at-risk numbers underneath.

Template previewPlotly
Rendering…

Make it your own.

{
  "data": [
    { "type":"scatter","mode":"lines","name":"Treatment",
      "x":[0,3,6,9,12,15,18,21,24],
      "y":[1.0,0.94,0.88,0.83,0.79,0.76,0.72,0.69,0.66],
      "line":{"shape":"hv","color":"#3666ff","width":3} },
    { "type":"scatter","mode":"lines","name":"Control",
      "x":[0,3,6,9,12,15,18,21,24],
      "y":[1.0,0.88,0.78,0.69,0.61,0.55,0.49,0.44,0.40],
      "line":{"shape":"hv","color":"#dc2626","width":3} }
  ],
  "layout":{
    "title":"Overall survival (HR 0.62, 95% CI 0.48–0.81, p < 0.001)",
    "xaxis":{"title":"Months","dtick":3,"range":[0,24]},
    "yaxis":{"title":"Survival probability","range":[0.3,1.0],"tickformat":".0%"},
    "annotations":[
      {"text":"At risk — Treatment: 220, 205, 188, 172, 158, 147, 132, 121, 109","x":0,"y":-0.18,"xref":"paper","yref":"paper","showarrow":false,"align":"left","font":{"size":10}},
      {"text":"At risk — Control:     220, 196, 168, 142, 121, 102, 88, 75, 64","x":0,"y":-0.24,"xref":"paper","yref":"paper","showarrow":false,"align":"left","font":{"size":10}}
    ],
    "margin":{"b":120}
  }
}