how to make a break in y-axis in a barplot

16 Views Asked by At

I want to emphasize a bit more the data on the lower values of the plot. Until now I've only managed to break the labels on the y-axis, but not the actual scale. I'll append an image as an example of what I want to achieve: Ponce 2017. Differentialing structural and compositional attributes…

My goal is to add a gap with the // symbol at the range: 4000-13000, because I need to apply this to some other 5 plots that have different data ranges, but I want all them to limit the y-axis in 14.000

This is my code (one of severals like this, but filtered with different PLOTs):

gg_reg_tol1<-ggplot(Cd_Reg%>%filter(PLOT==1),aes(x=CLASE,y=CANTD,fill=TOLERANCIA))+
  geom_col(position = position_dodge2(),colour="black",
           width=0.5,size=.3)+
  scale_fill_manual(labels=  c(" Intolerantes"," Semitolerantes"," Tolerantes"),
                    values = c("#FFFFFF","#999999","#000000"))+
  theme_classic() +
  scale_y_continuous(expand = c(0,0), breaks = seq(0,22000,2000),
                     limits = c(0,14000))+
  scale_x_discrete(breaks=c("P","M","G","B"),labels = c("5-50","50-100","100-200",">200"))+
  labs(x="",
       y="")+
  theme(legend.position = c(0.85,0.75),
        axis.text=element_text(size=20,colour="black",family="serif"),
        axis.title.x = element_text(size=20,colour="black",family="serif",face="bold"),
        axis.title.y=element_text(size=20,colour="black",family="serif",face="bold"),
        legend.text = element_text(size = 20,colour="black",family="serif"),
        legend.title = element_text(size = 0.1,colour="black",family="serif"),
        legend.key.size = unit(0.3,"cm"),
        axis.line = element_line(size = .3,colour="black"),
        axis.ticks = element_line(size=.3,colour="black"))

I've tried with ´breaks´ and ´oob´ arguments, but it only altered the labels of the axis, not the actual scale.

0

There are 0 best solutions below