I want to close the gap between the two graphs and to make it seem like it is a single graph.
I saw [this solution][1] but it's doesn't work for me.
Thanks in advance
![My plot][2]
library(ggplot2)
library(patchwork)
bp_data=read.csv("./LA metals.csv")
values<- read.csv("metals values.csv")
b = seq(from = 0, to = 226, by = 10)
l = c(0, 226)
year=bp_data$Name=as.factor(bp_data$Name)
bp=ggplot(bp_data,aes(x = Name, y = Pb.Ca)) +
stat_boxplot(geom ='errorbar',width=0.5)+
stat_summary(fun=mean, geom="point", shape=20, size=3, color="cornflowerblue")+
geom_boxplot(color = "black", width = 0.5)+
geom_hline(yintercept = 5.4, size=1,color="red")+
scale_y_continuous(breaks = b, limits = l,expand = c(0, 0))
Pb.lach=subset(values[c(3:4),c(1,6:7)])
Name=Pb.lach$Term=as.factor(Pb.lach$Term)
val=ggplot(Pb.lach,aes(x = Name, y = Pb.Ca))+
geom_point()+
geom_errorbar(aes(ymin=Pb.Ca-SD.2, ymax=Pb.Ca+SD.2), width=.2)+
scale_y_continuous(breaks = b, limits = l,expand = c(0, 0))
bp+val