2014-04-01 149 views
0

我有一个图,其中在y标签具有用于在它的数量级,其余产生具有下面的行上标:matplotlib TEX标签添加/删除空格

# plt is acquired from matplotlib.pyplot 
# orderMagnitude is a variable taken from a different part of the code 
plt.ylabel('${\mathrm{Intensity (10^'+str(int(orderMagnitude))+')}}$') 

{\mathrm{..}}部分加入,因为没有它的整个文本将是斜体(实际数字除外)。我有该行现在似乎除去Y(强度)和开放之间的白色空间“(”然而,似乎在orderMagnitude后添加一些空白(见图片)。

enter image description here

不有人知道为什么会发生这种情况吗?

+0

使用'\ text {Intensity}'而不是'\ mathrm',在数学模式中也可以看到[here](http://www.personal.ceu.hu/tex/math.htm#spacing) –

回答

1

你不需要把整条线放在数学模式下,这是你陷入困境的一部分,特别是你将整个方程放在\ mathrm {}中,而不仅仅是{Intensity }。下面的内容可能会更好,并且不应该在最后得到额外的空白:

plt.ylabel('Intensity $(10^{' + str(int(orderMagnitude)) + '})$')