Updated flow to output plot as pdf.