我想在用matplotlib绘制的绘图的axes标签中写入latex数学模式符号$\bar{T}$。documentation声明不支持数学模式,所以我尝试了
plt.xlabel(r'$\displaystyle \={T}$',fontsize=12)
以及
^{pr2}$这就产生了错误
matplotlib.pyparsing.ParseFatalException: Expected end of math '$'
$\displaystyle \={T}$ (at char 0), (line:1, col:1)
以及
raise ParseFatalException(msg + "\n" + s)
matplotlib.pyparsing.ParseFatalException: Expected end of math '$'
$\={T}$ (at char 0), (line:1, col:1)
>>>
有没有办法用matplotlib把这个符号写在轴标签上?我已经能够写其他乳胶轴标签,但我从来没有使用过这些special characters.
链接到的文档页面描述了调用Latex以提供格式化文本,但matplotlib有自己内置的数学表达式解析器,可以很好地处理大多数Latex数学命令,而无需实际运行外部Latex命令。除非您专门将matplotlib安装设置为使用外部安装的Latex,否则您仍然使用内置的数学解析器,它可以处理
\bar{}
很好:相关问题 更多 >
编程相关推荐