nanxstats / blog-comments

utterances comments
0 stars 1 forks source link

blog/post/ggplot2-color-interpolation/ #22

Open utterances-bot opened 5 months ago

utterances-bot commented 5 months ago

Adaptive ggplot2 Color Scales with Color Interpolation - Nan Xiao | 肖楠

Create discrete ggplot2 color scales that are adaptive to the number of categories in the data.

https://nanx.me/blog/post/ggplot2-color-interpolation/

docsuhail commented 5 months ago

Hi, can you please let me know how to use the ggsci package for my survival analysis: Here is my code:

km_curve +
  geom_vline(xintercept = 1, linetype = 'dashed', colour = 'red', size = 1) +
  geom_hline(yintercept = summary(s1, times = 50)$surv, linetype = 'dashed', colour = 'red', size = 1) + 
  coord_cartesian(xlim = c(0, 480))

# Kaplan-Meier plots ======================================================
## Plot -------------------------
km_curve <- ggsurvfit(s1, linewidth = 1) +
  labs(x = 'Months', y = 'Overall survival') +
  add_confidence_interval() +
  add_risktable() +
  scale_ggsurvfit() + 
  biostatsquid_theme +
  coord_cartesian(xlim = c(0, 400))