Unable to Knit To PDF the Rnotebook containing Python code

I'm Knit To PDF the R-notebook containing the following code:

import matplotlib
import numpy as np
import matplotlib.pyplot as plt

import matplotlib.pyplot as plt
import numpy as np

t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)

plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
plt.title('About as simple as it gets, folks')
plt.grid(True)
plt.savefig("test.png")
plt.show()

When I choose Knit To PDF, this error appears:

This application failed to start because it could not find or load the Qt platform plugin "windows" in "". Reinstalling the application may fix this problem.

image

On the other hand, when choosing to Knit To PDF a R-notebook that contains only R code, everything works fine.

Could you please help me resolve this error?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.