When creating a pdf file in a jupyter laptop, everything works fine, but I would like to keep the embedded shapes inside the pdf, as well as the laptop.
Here is my code:
%matplotlib notebook
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png', 'pdf')
save_figures = True
x = np.arange(0, 20, 0.1)
y = np.sin(x)
plt.figure()
plt.plot(x, y)
if save_figures:
plt.savefig('test.png')
plt.show()
The numbers appear on the line, but in pdf what is printed looks like this:
<IPython.core.display.Javascript object>
<IPython.core.display.HTML object>
The same thing appears in pdf if I export from the Internet or use nbconvertto export to pdf from the command line.
Are there any additional commands I need to call in order to get this to work?
source
share