在ggplot中对齐长图例标题

时间:2019-05-16 19:29:00

标签: r ggplot2

我有一个生成的图,如下所示:

gplot(aggregate(cbind(Tax_Burden,debt_GDP) ~ cou, data=df, mean, na.rm=TRUE), aes(x=log(debt_GDP), y=log(Tax_Burden))) +
  #geom_text(aes(label=cou), size=2) +  
  geom_point(aes(color = Tax_Burden, size=debt_GDP))+  
  labs(color = "Tax Burden [% Total Revenues]", size = "Public Debt [% GDP]")+
  geom_smooth(method=lm, se=FALSE, linetype="dashed")+
  geom_text_repel(aes(label = cou), size = 2)+
  ylab("Log of Tax Burden") +
  xlab("Log of Public Debt [% GDP]") +
  theme_minimal() +
  theme(legend.background = element_blank(),
        legend.key   = element_blank(),
        legend.text  = element_text(size = 6),
        legend.title=element_text(size=6),
        panel.border = element_blank(),
        panel.background = element_blank(),
        axis.title.x = element_text(size = 8), 
        axis.title.y = element_text(size = 8))

我的问题是,在图例color中,其标题太长[我将图例向右对齐]。我应该如何修改主题中的选项以说明该长标题?

例如如何将长图块Tax Burden [% Total Revenues]分成两行?

0 个答案:

没有答案