在 matplotlib 中对齐 TeX 方程
我有以下几行在我的 matplotlib
绘图上注释 TeX:
import matplotlib.pyplot as plt
from matplotlib import rc
rc('text', usetex=True)
rc('font', family='serif')
r = 1
v = 2
i = 3
notes = r"\noindent$R_L = {0}\\ V_2 = {1}\\ I_2 = {2}$".format(r, v, i)
plt.annotate(notes, xy=(5,5), xytext=(7,7))
plt.show()
How do I make the equals sign to another?我尝试了几种方法,例如 \begin{align}
、&
-placement,但我不太明白。
I have the following lines to annotate TeX on my matplotlib
plot:
import matplotlib.pyplot as plt
from matplotlib import rc
rc('text', usetex=True)
rc('font', family='serif')
r = 1
v = 2
i = 3
notes = r"\noindent$R_L = {0}\\ V_2 = {1}\\ I_2 = {2}$".format(r, v, i)
plt.annotate(notes, xy=(5,5), xytext=(7,7))
plt.show()
How do I make the equals signs align to each other? I experimented with several methods like \begin{align}
, &
-placement, but I don't quite get it right.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用eqnarray。
代码的简化版本:
为了使其正常工作,我必须安装 dvipng (按照此处的建议, http: //matplotlib.sourceforge.net/users/usetex.html)
Use
eqnarray
.A simplified version of your code:
To get it working I had to install dvipng (as suggested here, http://matplotlib.sourceforge.net/users/usetex.html)