我尝试导入xcolor包:
import matplotlib.pyplot as plt
plt.rcParams['text.latex.preamble']=[r"\usepackage{xcolor}"]
我有一个错误:
File "test.py", line 336
rc('text.latex', preamble="\usepackage{color}")
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: truncated \uXXXX escape
请问如何解决?
我这样做的原因是为文本着色:
ax.text3D(2.3e-15, -7.02e-15, 1.65e-14, r'$x \textcolor{white}{r}$')
谢谢