ggplot(.predict)为什么不改变R中的颜色/调色板?

时间:2019-02-05 12:48:14

标签: r ggplot2 plot rms

请在下面找到My Data。我有以下情节

enter image description here

我要应用“ jco”调色板(或仅手动键入“ #xxxxxx”颜色)。但是,我无法使其工作。我尝试过

library(ggplot2)
library(ggsci)
ggplot(Predict(model, ref.zero = TRUE, fun=exp)) + scale_color_jco() + scale_fill_jco()

我怎么

1)手动将颜色更改为#xxxxxx吗?

2)是否应用JCO调色板?

My Data

library(rms)
model <- cph(Surv(Follow.up.death,Death)~rcs(total.mbq),data=w)

w <- structure(list(Follow.up.death = c(18, 2, 14, 17, 31, 4, 20, 
15, 12, 19, 10, 17, 27, 22, 3, 43, 24, 14, 13, 5, 12, 137, 22, 
87, 48, 24, 72, 32, 14, 83, 68, 56, 57, 18, 16, 70, 1.9, 69.2, 
126.3, 41.6, 17.9, 1.3, 87.4, 4.4, 137.4, 17.5, 95.8, 65.2, 14.8, 
98.5, 16.6, 74.9, 10.3, 43.4, 32.5, 4.8, 7.3, 107.8, 6.8, 18.3, 
33, 25.2, 49.2, 15.9, 1.2, 42.7, 1, 9, 1.8, 15.6, 8.9, 15, 16.4, 
7.7, 75.5, 12.2, 54.8, 22.2, 9.7, 14.3, 5.2, 64.5, 21.8, 0.2, 
7.3, 18.7, 5.1, 17.3, 27.4, 16, 24.2, 9.7, 8.2, 5.7, 41.8, 10.6, 
22.8, 4.8, 6, 4, 50, 21, 30, 5, 11, 12), Death = c(0L, 1L, 1L, 
0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 
0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 
0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 
1L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 
1L, 0L, 0L, 0L, 0L, 0L, 0L), total.mbq = c(29354L, 7445L, 22309L, 
29699L, 29711L, 14765L, 22257L, 29715L, 29772L, 13320L, 20905L, 
12950L, 3400L, 14800L, 7400L, 21890L, 19400L, 14800L, 14700L, 
22200L, 1688L, 4500L, 8438L, 13500L, 14800L, 12580L, 12950L, 
13320L, 11840L, 13320L, 14800L, 13690L, 11250L, 12210L, 13320L, 
13320L, 14800L, 12580L, 20720L, 11840L, 14800L, 7030L, 14800L, 
14800L, 8325L, 11100L, 10730L, 13690L, 12210L, 14800L, 13320L, 
14800L, 12950L, 22200L, 17945L, 22200L, 8140L, 13690L, 11581L, 
14430L, 13320L, 13320L, 21090L, 11100L, 3885L, 6475L, 6660L, 
6660L, 5920L, 7500L, 5000L, 12500L, 12500L, 10000L, 12500L, 7500L, 
15000L, 10000L, 5000L, 7500L, 5000L, 15000L, 12500L, 7500L, 7500L, 
7500L, 5000L, 10000L, 10000L, 10000L, 12500L, 5000L, 5000L, 10000L, 
12500L, 5000L, 10000L, 10000L, 22200L, 14800L, 29000L, 14000L, 
4800L, 21600L, 28800L, 11400L)), .Names = c("Follow.up.death", 
"Death", "total.mbq"), class = "data.frame", row.names = c(NA, 
-106L))

0 个答案:

没有答案