With ggplot2, is there a way to specify a colourbar width which is scaled relative to the size of the plot panel?
i.e. what can be supplied to legend.key.width such that the relative width of the key is kept the same regardless of the size of the plot?
ggplot(mpg) +
geom_point(aes(cty, hwy, color = year)) +
theme(legend.position = "bottom",
legend.key.width = unit(0.1, "npc")) # not relative
# or could it be done with a custom theme?
my_theme <- function() {
theme_bw() %+replace%
theme(legend.position = "bottom", ?)
ggplot(mpg) +
geom_point(aes(cty, hwy, color = year)) +
my_theme()


