/// <summary>
        /// The write plot.
        /// </summary>
        /// <param name="plot">
        /// The plot.
        /// </param>
        public void WritePlot(PlotFigure plot)
        {
            if (this.FileName == null)
            {
                return;
            }

            var directory = Path.GetDirectoryName(this.FileName);
            if (directory == null)
            {
                return;
            }

            var source = string.Format(
                "{0}_Plot{1}.png", Path.GetFileNameWithoutExtension(this.FileName), plot.FigureNumber);
            var sourceFullPath = Path.Combine(directory, source);

            // write to a png
            // todo: write to a stream, not to disk
            PngExporter.Export(plot.PlotModel, sourceFullPath, (int)plot.Width, (int)plot.Height);

            // append the image to the document
            this.AppendImage(sourceFullPath, "Plot" + plot.FigureNumber);

            this.body.Append(CreateParagraph(plot.GetFullCaption(this.style), FigureTextID));
        }