1

I keep trying to follow the examples I see for PdfPages but keep getting the value error: No such figure: None.

plot1 = Chart Generating Function(argument1, argument2,...)

from matplotlib.backends.backend_pdf import PdfPages

pp = PdfPages('sample.pdf')
pp.savefig(plot1)
plt.close() 

I've tried different variations of this (i.e. pdf.savefig()) but nothing seems to work.

1
  • Please post a runnable piece of code reproducing the problem. With what you have now, the only piece of psychic advice I can offer is to check that your Chart Generating Function actually returns anything. Commented Nov 20, 2015 at 4:00

2 Answers 2

2

What solved the problem for me was removing the plt.show() command at the end of my chart generating function.

Sign up to request clarification or add additional context in comments.

Comments

0

I should have added more details, but somewhere in my code I had used "fig, ax = ..." when defining the figure. The "fig" part needed to be the argument in pdf.savefig(fig) in order for it to work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.