Skip to content

Instantly share code, notes, and snippets.

@aunyks
Last active May 10, 2022 00:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aunyks/26cd02d98c52f73370902989432e40cb to your computer and use it in GitHub Desktop.
Save aunyks/26cd02d98c52f73370902989432e40cb to your computer and use it in GitHub Desktop.
A Python program for generating LaTeX expressions.
import matplotlib.pyplot as plt
import sympy
limxtoinf = sympy.Symbol('\lim_{x\\to\infty}')
# THE LATEX EXPRESSION TO BE PRINTED
expr = sympy.latex(limxtoinf)
# OR
#expr = '\lim_{x\\to\infty}'
#add text
plt.text(0.2, 0.7, r"$%s$" % expr, fontsize = 50)
#hide axes
fig = plt.gca()
fig.axes.get_xaxis().set_visible(False)
fig.axes.get_yaxis().set_visible(False)
plt.draw() #or savefig
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment