title: How do you plot smooth components of different GAMs in same panel?
body: <p>I have two GAMs which have the same predictor variables but different independent variables. I would like to combine the two GAMs to a set of plots where the smooth component (partial residuals) of each predictor variable are in the same panel (differentiated with e.g. color). Reproducible example:</p>
  <pre><code># Required packages
  require(mgcv)
  require(mgcViz)
  
  # Dataset
  data(&quot;swiss&quot;)
  
  # GAM models
  fit1 &lt;- mgcv::gam(Fertility ~ s(Examination) + s(Education), data = swiss)
  fit2 &lt;- mgcv::gam(Agriculture ~ s(Examination) + s(Education), data = swiss)
  
  # Converting GAM objects to a gamViz objects
  viz_fit1 &lt;- mgcViz::getViz(fit1)
  viz_fit2 &lt;- mgcViz::getViz(fit2)
  
  # Make plotGAM objects
  trt_fit1 &lt;- plot(viz_fit1, allTerms = T) + l_fitLine()
  trt_fit2 &lt;- plot(viz_fit2, allTerms = T) + l_fitLine()
  
  # Print plots
  print(trt_fit1, pages = 1)
  print(trt_fit2, pages = 1)
  </code></pre>
  <p>Plot of fit1 looks like this:</p>
  <p><a href="https://i.stack.imgur.com/vlaah.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vlaah.png" alt="trt_fit1" /></a></p>
  <p>And fit2 like this:</p>
  <p><a href="https://i.stack.imgur.com/eMiGQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eMiGQ.png" alt="trt_fit2" /></a></p>
  <p>So I would like to combine the two Examinations into one panel, and the two Educations into another one, showing the independent variable (from different GAMs) with different color/linetype.</p>