如何通过 python 绘图在字符串中输入较低的条形图?
How to type lower bar in a string by python plot?
我想在 python 图中添加一些文本。我正在使用 r'$\bar{p}$',但我希望栏位于底部。我尝试使用乳胶包 accent 并编写 r'$\usepackage{accents} \underaccent{\bar}{p}$'。但是没用。
知道怎么做吗?
提前致谢。
这并不理想,因为 \underline
生成的行与 \underaccent
略有不同,但您仍然可以按照 this answer 中提到的方式使用它。
要使字母 p 与乳胶公式中的字体相同,可以使用 \underline{$p$}
。
这是一个简短的例子:
import matplotlib.pyplot as plt
from matplotlib import rc
rc('text',usetex=True)
import numpy as np
x=np.arange(-5,5,0.1)
ax.plot(x,np.sin(x),label=r'\underline{$p$}')
ax.legend()
f.show()
我想在 python 图中添加一些文本。我正在使用 r'$\bar{p}$',但我希望栏位于底部。我尝试使用乳胶包 accent 并编写 r'$\usepackage{accents} \underaccent{\bar}{p}$'。但是没用。
知道怎么做吗? 提前致谢。
这并不理想,因为 \underline
生成的行与 \underaccent
略有不同,但您仍然可以按照 this answer 中提到的方式使用它。
要使字母 p 与乳胶公式中的字体相同,可以使用 \underline{$p$}
。
这是一个简短的例子:
import matplotlib.pyplot as plt
from matplotlib import rc
rc('text',usetex=True)
import numpy as np
x=np.arange(-5,5,0.1)
ax.plot(x,np.sin(x),label=r'\underline{$p$}')
ax.legend()
f.show()