python - 如何在matplotlib中将 'underbar'放在字母(下划线字符)下面?

标签 python matplotlib latex

不幸的是,由于 Windows 的问题,我无法渲染任何 matplotlib文本为 LaTeX 。所以基本上我已经需要离开 matplotlib's文本处理以在字母下方放置一行。

到目前为止,我最接近的是 ax.text(x,y,z, r'$\mathbf{\underbar r}$') ,但这只会产生 _r 。因此,如果有办法让这个栏位于“r”下方,那就太棒了。提前致谢!

附注我已经尝试过ax.text(x,y,z, r'$\underline{\mathbf{r}}$')但这似乎不起作用,:,(

编辑

刚刚意识到你可以“作弊”matplotlib :D 通过将文本放置在完全相同的位置,仅使用 \underbar ,这使得它出现在字母下方。即ax.text(x,y,z, r'$\mathbf{r}$')接下来是 ax.text(x,y,z, r'$\mathbf{\underbar}$')

但是仍然会感激更快的方法,谢谢!

最佳答案

您可以在下划线和角色之间使用一些负间距。在这种情况下,将 \! 增加三倍似乎效果很好:

ax.text(2,7, r'$\mathbf{\underbar \!\!\! r }$')

enter image description here

关于python - 如何在matplotlib中将 'underbar'放在字母(下划线字符)下面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41642265/

相关文章:

python - Matplotlib,关闭循环的按钮,python

python - Matplotlib 一张图中的多种颜色

python - Manim 中的 LaTeX Surd 着色问题

python - 将 C 的 fread 转换为 python,没有得到预期的输出

python - 在 pandas 中创建具有多级索引的数据透视表

python - 将 Pandas DataFrame 转换为字典

python - 保存没有边距的 matplotlib/networkx 图

latex - 在 Latex 中将摘要添加到首页

pdf - 如何更改 Doxygen 创建的 PDF 文档的边距?

python - 将两个高斯/正态分布的混合拟合到一组数据中的直方图,python