I am trying to make Kaplan Meier curves using the survminer package and then using ggplot2 to polish how it all looks. After I have created my survival object(g2) using the ggsurvplot function, I then want to create a table showing survival data. This all works very well until I apply theme_tq to the table. This is the code I am using:
I have added two images showing the before and after applying theme_tq, as you can see, the colors for each subgroup disappear, it all becomes black.Before After
g2_table <- g2$table +
  scale_color_tq() +
  scale_fill_tq() +
  theme_tq(base_size = 20, base_family = "paper_II_font") +
  theme(plot.margin = unit(c(0,0.2,0.01,0.1), "cm"))+
  theme(axis.text.x= element_text(face = "bold")) +
  theme(axis.text.y= element_text(face = "bold")) +
  theme(axis.title.y = element_blank()) +
  theme(axis.title.x = element_blank()) +
  theme(axis.text.x=element_blank()) +
  theme(panel.grid = element_blank())
I was expecting it to create the table with theme_tq however I also expected the colors to be unchanged, I don't understand why they changed to all black.
 
                        
The issue is that by applying
theme_tqthis way you are overwriting the theme already applied byggsurvplotunder the hood, including the theme adjustments to apply the colors to theaxis.text. Instead I would suggest to apply your desired theme including any tweaks directly by passing it to thetable.theme(and/orggtheme) argument ofggsurvplot. Also, as far as I get it,scale_color_tqandscale_fill_tqwill have no effect. Instead pass your desired colors to thepalette=argument, e.g. for the default color palette used byscale_color_tqusepalette_light().Using the default example from
?ggsurvplot: