将 matplotlib 标题的一部分设为粗体和不同的颜色 [英] Make part of a matplotlib title bold and a different color
本文介绍了将 matplotlib 标题的一部分设为粗体和不同的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将标题的一部分改为粗体.例如:
I would like to change part of a title to be bold. For example:
plt.title("This is title number: " + str(number))
给定像上面这样的标题,我如何将 str(number)
部分加粗.
Given a title like the above, how would I bold the str(number)
part.
推荐答案
激活 Latex 文本渲染
from matplotlib import rc
rc('text', usetex=True)
plt.title("This is title number: " + r" extbf{" + str(number) + "}")
这篇关于将 matplotlib 标题的一部分设为粗体和不同的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文