use*_*093 13 python matplotlib
我想将标题的一部分改为粗体.例如:
plt.title("This is title number: " + str(number))
Run Code Online (Sandbox Code Playgroud)
鉴于如上所述的标题,我将如何加粗该str(number)部分.
Imp*_*est 23
从matplotlib版本2开始,不需要使用乳胶(这需要安装胶乳).可以使用普通的MathText以粗体呈现标题的一部分.
import matplotlib.pyplot as plt
number = 2017
plt.title("This is title number: " + r"$\bf{" + str(number) + "}$")
plt.show()
Run Code Online (Sandbox Code Playgroud)
use*_*093 12
from matplotlib import rc
rc('text', usetex=True)
plt.title("This is title number: " + r"\textbf{" + str(number) + "}")
Run Code Online (Sandbox Code Playgroud)