我正在try 在我的情节中使用斜体:
import matplotlib.pyplot as plt
plt.plot([1,2,3],[1,1,1], label = '$\it{ABC123}$')
plt.legend()
plt.show()
如Styling part of label in legend in matplotlib%所示
但这只是ABC
的斜体,而不是123
,这也被注意到了,但没有解决,Matplotlib italic font cannot be applied to numbers in the legend?
我也试过usetex
,italic symbols in matplotlib?,但那changes the fonts使这个数字与我正在制作的其他数字不相容.
我在使用Python3.10.12和
matplotlib 3.8.1
matplotlib-inline 0.1.3
我怎样才能同时使用字母和数字的斜体,例如ABC123
?