code: def set_titles(self, template="{coord} = {value}", maxchar=30,
                     **kwargs):
          
          import matplotlib as mpl
  
          kwargs["size"] = kwargs.pop("size", mpl.rcParams["axes.labelsize"])
  
          nicetitle = functools.partial(_nicetitle, maxchar=maxchar,
                                        template=template)
  
          if self._single_group:
              for d, ax in zip(self.name_dicts.flat, self.axes.flat):
                  # Only label the ones with data
                  if d is not None:
                      coord, value = list(d.items()).pop()
                      title = nicetitle(coord, value, maxchar=maxchar)
                      ax.set_title(title, **kwargs)
          else:
              # The row titles on the right edge of the grid
              for ax, row_name in zip(self.axes[:, -1], self.row_names):
                  title = nicetitle(coord=self._row_var, value=row_name,
                                    maxchar=maxchar)
                  ax.annotate(title, xy=(1.02, .5), xycoords="axes fraction",
                              rotation=270, ha="left", va="center", **kwargs)
  
              # The column titles on the top row
              for ax, col_name in zip(self.axes[0, :], self.col_names):
                  title = nicetitle(coord=self._col_var, value=col_name,
                                    maxchar=maxchar)
                  ax.set_title(title, **kwargs)
  
          return self
docs: Draw titles either above each facet or on the grid margins.
  
          Parameters
          ----------
          template : string
              Template for plot titles containing {coord} and {value}
          maxchar : int
              Truncate titles at maxchar
          kwargs : keyword args
              additional arguments to matplotlib.text
  
          Returns
          -------
          self: FacetGrid object