Description Usage Arguments Value Examples
Risk Score Plot for Cox Regression
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ggrisk(
fit,
heatmap.genes = NULL,
new.data = NULL,
code.0 = "Alive",
code.1 = "Dead",
code.highrisk = "High",
code.lowrisk = "Low",
cutoff.show = TRUE,
cutoff.value = "median",
cutoff.x = NULL,
cutoff.y = NULL,
cutoff.label = NULL,
title.A.ylab = "Risk Score",
title.B.ylab = "Survival Time",
title.A.legend = "Risk Group",
title.B.legend = "Status",
title.C.legend = "Expression",
size.ABC = 1.5,
size.ylab.title = 14,
size.Atext = 11,
size.Btext = 11,
size.Ctext = 11,
size.yticks = 0.5,
size.yline = 0.5,
size.points = 2,
size.dashline = 1,
size.cutoff = 5,
size.legendtitle = 13,
size.legendtext = 12,
color.A = c(low = "blue", high = "red"),
color.B = c(code.0 = "blue", code.1 = "red"),
color.C = c(low = "blue", median = "white", high = "red"),
vjust.A.ylab = 1,
vjust.B.ylab = 2,
family = "sans",
expand.x = 3,
relative_heights = c(0.1, 0.1, 0.01, 0.15)
)
|
fit |
cox regression results of coxph() from 'survival' package or cph() from 'rms' package |
heatmap.genes |
(optional) numeric variables. Name for genes |
new.data |
new data for validation |
code.0 |
string. Code for event 0. Default is 'Alive' |
code.1 |
string. Code for event 1. Default is 'Dead' |
code.highrisk |
string. Code for highrisk in risk score. Default is 'High' |
code.lowrisk |
string. Code for lowrisk in risk score. Default is 'Low' |
cutoff.show |
logical, whether to show text for cutoff in figure A. Default is TRUE |
cutoff.value |
string, which can be 'median', 'roc' or 'cutoff'. Even you can define it by yourself |
cutoff.x |
numeric (optional), ordination x for cutoff text |
cutoff.y |
numeric (optional), ordination y for cutoff text |
cutoff.label |
(should be) string. Define cutoff label by yourself |
title.A.ylab |
string, y-lab title for figure A. Default is 'Risk Score' |
title.B.ylab |
string, y-lab title for figure B. Default is 'Survival Time' |
title.A.legend |
string, legend title for figure A. Default is 'Risk Group' |
title.B.legend |
string, legend title for figure B. Default is 'Status' |
title.C.legend |
string, legend title for figure C. Default is 'Expression' |
size.ABC |
numeric, size for ABC. Default is 1.5 |
size.ylab.title |
numeric, size for y-axis label title. Default is 14 |
size.Atext |
numeric, size for y-axis text in figure A. Default is 11 |
size.Btext |
numeric, size for y-axis text in figure B. Default is 11 |
size.Ctext |
numeric, size for y-axis text in figure C. Default is 11 |
size.yticks |
numeric, size for y-axis ticks. Default is 0.5 |
size.yline |
numeric, size for y-axis line. Default is 0.5 |
size.points |
numeric, size for scatter points. Default is 2 |
size.dashline |
numeric, size for dashline. Default is 1 |
size.cutoff |
numeric, size for cutoff text. Default is 5 |
size.legendtitle |
numeric, size for legend title. Default is 13 |
size.legendtext |
numeric, size for legend text. Default is 12 |
color.A |
color for figure A. Default is low = 'blue', high = 'red' |
color.B |
color for figure B. Default is code.0 = 'blue', code.1 = 'red' |
color.C |
color for figure C. Default is low = 'blue', median = 'white', high = 'red' |
vjust.A.ylab |
numeric, vertical just for y-label in figure A. Default is 1 |
vjust.B.ylab |
numeric, vertical just for y-label in figure B. Default is 2 |
family |
family, default is sans |
expand.x |
numeric, expand for x-axis |
relative_heights |
numeric, relative heights for figure A, B, colored side bar and heatmap. Default is 0.1 0.1 0.01 and 0.15 |
A risk score picture
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | library(rms)
library(ggrisk)
fit <- cph(Surv(time,status)~ANLN+CENPA+GPR182+BCO2,LIRI)
ggrisk(fit,
cutoff.value='median',
cutoff.x = 145,
cutoff.y = -0.8)
#more detailed example
#plot
ggrisk(fit)
#heatmap.genes
ggrisk(fit,
heatmap.genes=c('GPR182','CENPA','BCO2'))
#cutoff
ggrisk(fit,
cutoff.value='median') #default
ggrisk(fit,
cutoff.value='roc')
ggrisk(fit,
cutoff.value='cutoff')
ggrisk(fit,
cutoff.value=-1)
ggrisk(fit,
cutoff.value='median',
cutoff.x = 145,
cutoff.y = -0.8)
ggrisk(fit,
cutoff.value='median',
cutoff.x = 145,
cutoff.y = -0.8,
cutoff.label='This is cutoff')
#code for 0 and 1
ggrisk(fit,
cutoff.value='median',
cutoff.x = 145,
cutoff.y = -0.8,
code.0 = 'Still Alive',
code.1 = 'Already Dead')
#code for high and low risk group
ggrisk(fit,
cutoff.value='median',
cutoff.x = 145,
cutoff.y = -0.8,
code.0 = 'Still Alive',
code.1 = 'Already Dead',
code.highrisk = 'High Risk',
code.lowrisk = 'Low Risk')
#title
ggrisk(fit,
cutoff.value='median',
cutoff.x = 145,
cutoff.y = -0.8,
code.0 = 'Still Alive',
code.1 = 'Already Dead',
code.highrisk = 'High Risk',
code.lowrisk = 'Low Risk',
title.A.ylab='Risk Score',
title.B.ylab='Survival Time(year)',
title.A.legend='Risk Group',
title.B.legend='Status',
title.C.legend='Expression')
#size
ggrisk(fit,
cutoff.value='median',
cutoff.x = 145,
cutoff.y = -0.8,
code.0 = 'Still Alive',
code.1 = 'Already Dead',
code.highrisk = 'High Risk',
code.lowrisk = 'Low Risk',
title.A.ylab='Risk Score',
title.B.ylab='Survival Time(year)',
title.A.legend='Risk Group',
title.B.legend='Status',
title.C.legend='Expression',
size.ABC=1.5,
size.ylab.title=14,
size.Atext=11,
size.Btext=11,
size.Ctext=11,
size.yticks=0.5,
size.yline=0.5,
size.points=2,
size.dashline=1,
size.cutoff=5,
size.legendtitle=13,
size.legendtext=12)
#color
ggrisk(fit,
cutoff.value='median',
cutoff.x = 145,
cutoff.y = -0.8,
code.0 = 'Still Alive',
code.1 = 'Already Dead',
code.highrisk = 'High Risk',
code.lowrisk = 'Low Risk',
title.A.ylab='Risk Score',
title.B.ylab='Survival Time(year)',
title.A.legend='Risk Group',
title.B.legend='Status',
title.C.legend='Expression',
size.ABC=1.5,
size.ylab.title=14,
size.Atext=11,
size.Btext=11,
size.Ctext=11,
size.yticks=0.5,
size.yline=0.5,
size.points=2,
size.dashline=1,
size.cutoff=5,
size.legendtitle=13,
size.legendtext=12,
color.A=c(low='blue',high='red'),
color.B=c(code.0='blue',code.1='red'),
color.C=c(low='blue',median='white',high='red'))
#vjust
ggrisk(fit,
cutoff.value='median',
cutoff.x = 145,
cutoff.y = -0.8,
code.0 = 'Still Alive',
code.1 = 'Already Dead',
code.highrisk = 'High Risk',
code.lowrisk = 'Low Risk',
title.A.ylab='Risk Score',
title.B.ylab='Survival Time(year)',
title.A.legend='Risk Group',
title.B.legend='Status',
title.C.legend='Expression',
size.ABC=1.5,
size.ylab.title=14,
size.Atext=11,
size.Btext=11,
size.Ctext=11,
size.yticks=0.5,
size.yline=0.5,
size.points=2,
size.dashline=1,
size.cutoff=5,
size.legendtitle=13,
size.legendtext=12,
color.A=c(low='blue',high='red'),
color.B=c(code.0='blue',code.1='red'),
color.C=c(low='blue',median='white',high='red'),
vjust.A.ylab=1,
vjust.B.ylab=2)
#family, expand, relative height
ggrisk(fit,
cutoff.value='median',
cutoff.x = 145,
cutoff.y = -0.8,
code.0 = 'Still Alive',
code.1 = 'Already Dead',
code.highrisk = 'High Risk',
code.lowrisk = 'Low Risk',
title.A.ylab='Risk Score',
title.B.ylab='Survival Time(year)',
title.A.legend='Risk Group',
title.B.legend='Status',
title.C.legend='Expression',
size.ABC=1.5,
size.ylab.title=14,
size.Atext=11,
size.Btext=11,
size.Ctext=11,
size.yticks=0.5,
size.yline=0.5,
size.points=2,
size.dashline=1,
size.cutoff=5,
size.legendtitle=13,
size.legendtext=12,
color.A=c(low='blue',high='red'),
color.B=c(code.0='blue',code.1='red'),
color.C=c(low='blue',median='white',high='red'),
vjust.A.ylab=1,
vjust.B.ylab=2,
family='sans',
expand.x=3,
relative_heights=c(0.1,0.1,0.01,0.15))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.