Note
Go to the end to download the full example code.
Minimal working example#
Minimal working example of pykz, plotting a simple sine function.
import numpy as np
import pykz
x = np.linspace(0, 10, 100)
y = np.sin(x)
pykz.plot(x, y)
# Export your tex code as a standalone file
pykz.save("basic_inline.tex", standalone=True)
# You could also directly build the pdf
pykz.io.export_pdf_from_file("basic_inline.tex")

'basic_inline.pdf'
Alternatively, output it to png
pykz.io.export_png_from_file("basic_inline.tex")
Or, save the Tikz code to a temporary file, compile it, and open the pdf in the default viewer.
This would be the equivalent to plt.show()
pykz.preview()
Total running time of the script: (0 minutes 0.655 seconds)
Related examples