I am trying to increase the margins between texts in a legend. My understanding is that this should be controlled with margins in theme - legend.text - element_text. This doesn't seem to work. Actually, any type of setting, including jhust, vjust, seems not to work with legend.text. Can anyone help?
In the example below I have put some absurd values for margins, with no results (see picture attached).
library(tidyverse)
data(midwest, package="ggplot2")
plot <- ggplot(midwest, aes(x=area, y=poptotal)) +
geom_bar(aes(fill=state), stat="identity") +
guides(fill=guide_legend(nrow=2)) +
scale_fill_brewer(palette ="Set1" ,labels = str_wrap(c("AAA AAA","BBB BBB","C","DDD DDD","E"),5)) +
theme(legend.position = "bottom", legend.text=element_text(margin=margin(t=100,r=100))
This is the real case on which I am trying to work.