Stagger axis labels, new feature in ggplot2

后端 未结 2 1837
余生分开走
余生分开走 2020-12-19 19:08

Hi there: I need to plot a factor with 81 different categories with different frequency counts each. Each factor name is a 4-letter category. It looks like this. As you ca

2条回答
  •  误落风尘
    2020-12-19 19:45

    Sandy mentions adding spaces to the labels. With a discrete axis, you can also simply add line breaks to alternate cases. In my case I wanted to stagger alternate ones:

    scale_x_discrete(labels=paste0(c("","\n"),net_change$TZ_t)
    

    Where net_change$TZ_t is my ordered factor. It extends to 'triple' levels easily with c("","\n","\n\n").

提交回复
热议问题