I'd like to add a title (in one colour/size) and a subtitle (in a second colour/size) to a legend element in ggplot2, like this:
But the best I can do so far is:
using this code:
gg <- ggplot(sig_table, aes(x = x, y = y, col = neg_log_FP)) +
geom_point(aes(size = as.numeric(percentage))) +
xlab("Cohort") +
ylab("Signature") +
scale_color_continuous(low = "blue", high = "red", name = "-log(pval)", limits = c(0,3)) +
scale_size(name = "Size of circle\nProportion of\nsamples within\ncohort", limits = c(0,100), range = c(0,12),
guide = guide_legend(override.aes=list(colour = "red"))) +
scale_x_discrete(limits = xlabels, position = "top") +
scale_y_discrete(limits = ylabels) +
theme_bw()
Is there a way to change the size of the text "Proportion of samples within cohort" to a smaller font?
NB: (in edit), this is not a duplicate of increase legend font size ggplot2, because I want two different sizes in the legend text, not a uniform size.