Print latex-formula with python

Как показать простую латексную формулу в Python? Maybe numpy is the right choice?

EDIT:

I have python code like:

a = '\frac{a}{b}'

and want to print this in a graphical output (like matplotlib).

12
задан kame 21 November 2019 в 08:40
поделиться

2 ответа

Потяните с matplotlib,

import matplotlib.pyplot as plt
a = r'\frac{a}{b}'
ax=plt.subplot(111)
ax.text(0.5,0.5,r"$%s$" %(a),fontsize=30,color="green")
plt.show()
<час>

enter image description here

1
ответ дан 2 December 2019 в 20:15
поделиться

Создание математических формул у Панд.

a = r'\frac{a}{b}'
ax = plt.axes([0,0,0.3,0.3]) #left,bottom,width,height
ax.set_xticks([])
ax.set_yticks([])
ax.axis('off')
plt.text(0.4,0.4,'$%s 

enter image description here

a = r'f(x) = \frac{\exp(-x^2/2)}{\sqrt{2*\pi}}'
ax = plt.axes([0,0,0.3,0.3]) #left,bottom,width,height
ax.set_xticks([])
ax.set_yticks([])
ax.axis('off')
plt.text(0.4,0.4,'$%s 

enter image description here

%a,size=50,color="green")

enter image description here

%a,size=50,color="green")

enter image description here

a = r'f(x) = \frac{\exp(-x^2/2)}{\sqrt{2*\pi}}'
ax = plt.axes([0,0,0.3,0.3]) #left,bottom,width,height
ax.set_xticks([])
ax.set_yticks([])
ax.axis('off')
plt.text(0.4,0.4,'$%s 

enter image description here

%a,size=50,color="green")

enter image description here

0
ответ дан 2 December 2019 в 20:15
поделиться
Другие вопросы по тегам:

Похожие вопросы: