Kalman-and-Bayesian-Filters.../pdf/rm_notebook.py
Roger Labbe 8463014958 Disable interactive plots for PDF.
nbconvert cannot output interactive plots to PDF. I wrote code
to remove all of the %matplotlib notebook magic, rerun the notebooks,
and then create the PDF.
2017-01-14 13:15:24 -08:00

16 lines
529 B
Python

import os, sys
print(sys.argv[1])
infile = open(sys.argv[1], encoding="utf8")
data = infile.read()
infile.close()
outfile = open(sys.argv[1], "w", encoding="utf8")
data = data.replace("%matplotlib notebook", "#%matplotlib notebook")
data = data.replace("%matplotlib inline #reset", "#%matplotlib inline #reset")
data = data.replace("time.sleep", "#time.sleep")
data = data.replace("fig.canvas.draw", "#fig.canvas.draw")
data = data.replace("plt.gcf().canvas.draw", "#plt.gcf().canvas.draw")
outfile.write(data)
outfile.close()