0

I'm trying to remove the empty space between the start of the data lines inside this graph and the axis. The min for the x axis is 25 but if I make that the lower xlim it still keeps that space, and if I make the lower xlim 50, there is also still a space.

f <- plot %>% 
  ggplot(aes(x=Mean_precip_cm,group=Age))+
  geom_smooth(aes(y=fit, col=Age), size=2, method=NULL, se=FALSE)+
  geom_ribbon(aes(ymin = lwr,ymax = upr, fill = Age), alpha=0.1)+
  theme_classic()+
  scale_x_continuous(limits = c(NA, NA), breaks = c(50, 100, 150, 200, 250,300,350))+
  labs(
    x = "Mean annual precipitation (cm)",
    y = "Predicted total depth (cm)",
    face = "bold" ) +
  theme(text = element_text(size = 15))+
  theme(axis.text.x= element_text(colour = "black", size = 15))+
  theme(axis.text.y= element_text(colour = "black", size = 15))+
  scale_color_canva(guide ="none", palette = "Fun and tropical") +
  scale_fill_canva(palette = "Fun and tropical") +
  theme(panel.background = element_rect(fill = 'transparent', colour = NA), plot.background = element_rect(fill = "transparent", colour = NA))
f

enter image description here

  • 1
    This is axis expansion. You can either use the `expanse` argument of your scales (i.e. `scale_x|y_continuous(expand = c(0, 0))`) or of the coordinate system (i.e. `+ coord_cartesian(expand = FALSE)` – Axeman May 10 '23 at 20:29

0 Answers0