I have built a gam model with the first graph.
a1 <- gam(death~s(time,bs="cr",k=200)+pm10median+so2median+ o3median+tmpd, data=chicago,family=poi