Closed
Description
Here is an issue I've been pondering: Should theme elements provided to guides inherit from the plot theme? Currently they don't, and I think this causes unexpected behavior.
Example: I'm trying to change the color of the legend title but I'm inadvertently also changing the font size.
library(ggplot2)
ggplot(mtcars, aes(disp, mpg, size = cyl, color = hp)) +
geom_point() +
theme_grey(6) +
scale_size(
guide = guide_legend(
title.theme = element_text(colour = "red")
)
)
Created on 2018-06-30 by the reprex package (v0.2.0).
I'd be happy to take a stab at this if we agree that the current behavior is sub-optimal. I think the right way to do it is to expand the calc_element()
function so it can take as an optional argument an element that would override the theme settings.