-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Is there any way to achieve the effect presented on the screenshot, made with the instructions I show below - which triggers a warning?
Description of the effect to achieve:
There is a set of faceted Kaplan-Meier curves. The study sponsor wants each panel to have it's own risk table (it cannot be negotiated - the risk table must be shown there and not elsewhere).
Each row of the risk table is linked to a corresponding curve by label and color.
I also had to make the font a bit smaller.
With the code I made it works perfectly and was accepted by the study sponsor.
which is made with this code:
..... +
scale_y_continuous(breaks = c(-.2, -.1, 0, .2, .4, .6, .8, 1),
labels = c("Resectable", "Unresectable", "0", "0.2", "0.4", "0.6", "0.8", "1"),
limits = c(-0.2, 1)) +
# make some space from the left
scale_x_continuous(breaks = c(0, 30, 60, 90, 120), limits = c(-5, NA)) +
# format the axis elements
theme(axis.text.y = element_text(colour = c("green3", "red3", rep("black", 6)),
size = c(7.5, 7.5, rep(8, 6)))) +
scale_color_manual(values=c("Resectable"="green3", "Unresectable"="red3"))
What bothers me is the warning (as mentioned in the title) I get all the time.
This is triggered by this line
theme(axis.text.y = element_text(colour = c("green3", "red3", rep("black", 6)),
size = c(7.5, 7.5, rep(8, 6)))) +
Is there any simple, elegant solution allowing me to obtain this very effect without the warning?
I read, that you may remove this awesome feature (vectorization on the element_text) some day - which would be really a pity, so the code will break. Please guide me how to achieve the same with similar efforts, as this template will be used by me very often.