Str*_*tch 6 python latex matplotlib
当我给matplotlib一个注释字符串,如
'$\frac{A}{B} = C$'
Run Code Online (Sandbox Code Playgroud)
我指定的字体大小为18,A和B的渲染速度为12.6 pt,而C的渲染速度为18 pt.我希望A,B和C都是相同的大小.我该怎么做呢?
在LaTeX文档中,如果您提供命令
\begin{equation}
\frac{A}{B} = C
\end{equation}
Run Code Online (Sandbox Code Playgroud)
你得到一个分数,其中A,B和C都是相同的大小,但如果你这样做
$\frac{A}{B} = C$
Run Code Online (Sandbox Code Playgroud)
与文本内联,你得到的A和B渲染为12.6 pt,而C则渲染为18 pt.因此看来matplotlib的mathtext正在模仿LaTeX的内联模式.在LaTeX中你可以写
$\displaystyle\frac{A}{B} = C$
Run Code Online (Sandbox Code Playgroud)
然后A,B和C都是相同的大小,即使在内联模式下也是如此.我在matplotlib中尝试了这个,但mathtext没有识别命令\ displaystyle.=(
有没有办法让这个在Matplotlib的mathtext中工作,或者我在我的.matplotlibrc文件中将text.usetex更改为true?(如果可能的话,我想继续使用mathtext,因为它要快得多.)
我的设置:matplotlib v1.2.0 python 2.7 OS X 10.8