def render(self, template=None):
        """Render the plot using a template.

        Once the plot is complete, it needs to be rendered.  Artist uses
        the Jinja2 templating engine.  The default template results in a
        LaTeX file which can be included in your document.

        :param template: a user-supplied template or None.
        :type template: string or None.
        :returns: the rendered template as string.

        """
        if not template:
            template = self.template

        for subplot in self.subplots:
            subplot._prepare_data()

        response = template.render(rows=self.rows, columns=self.columns,
                                   xmode=self.xmode, ymode=self.ymode,
                                   width=self.width, height=self.height,
                                   xlabel=self.xlabel, ylabel=self.ylabel,
                                   limits=self.limits, ticks=self.ticks,
                                   colorbar=self.colorbar,
                                   colormap=self.colormap,
                                   external_filename=self.external_filename,
                                   font_options=self.font_options,
                                   axis_options=self.axis_options,
                                   subplots=self.subplots,
                                   plot_template=self.template)
        return response