YuLab-SMU / ggbreak

:broken_heart: An implementation of scale functions for setting axis breaks of a 'gg' plot.
https://www.frontiersin.org/articles/10.3389/fgene.2021.774846
131 stars 4 forks source link

legend displaced above axis label with theme(legend.position = "bottom") #53

Open MonkeyCousin opened 2 years ago

MonkeyCousin commented 2 years ago

Hello the legend (or the axis label) is moved when attempting theme(legend.position = "bottom") Can you please show how this can be overcome?

d<-data.frame(x=1:20, y=c(rnorm(5)+4, rnorm(5)+20, rnorm(5)+5, rnorm(5)+22), group=c(rep('A',10),rep('B',10)), face=c(rep('C',5),rep('D',5),rep('E',5),rep('F',5))) p<-ggplot(d,aes(x=x,y=y)) + geom_col(oreientation='x') + scale_y_reverse() + facet_wrap(group~., scales='free_y', strip.position='right', nrow=2) + coord_flip() + scale_y_break(c(7,17),scale='free') + scale_y_break(c(19,21), scale='free') + aes(fill=group)+ theme(legend.position = "bottom")