When putting code inside of a function, embedding is throwing an error of <code block>:11: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend ...