这个警告是什么意思?我怎么才能摆脱这个呢?
Support for setting the 'text.latex.preamble' or 'pgf.preamble' rcParam to a list of strings is deprecated since 3.3 and will be removed two minor releases later; set it to a single string instead.
plt.rcParams['text.latex.preamble'] = [r"\usepackage{bm}", [r"\usepackage{amsmath}"]代码:
import matplotlib.pyplot as plt
plt.rcParams['text.latex.preamble'] = [r"\usepackage{bm}"], [r"\usepackage{amsmath}"]
params = {'text.usetex' : True,
'font.size' : 28,
'font.family' : 'lmodern',
}
plt.rcParams.update(params)发布于 2021-01-10 01:18:37
根据文档https://matplotlib.org/3.3.0/api/prev_api_changes/api_changes_3.3.0/deprecations.html#setting-rcparams-text-latex-preamble-default-or-rcparams-pdf-preamble-to-non-strings,将rcParams['text.latex.preamble']设置为字符串列表不再是正确的方式。
要修复此问题,您应该将
plt.rcParams['text.latex.preamble'] = [r"\usepackage{bm}"], [r"\usepackage{amsmath}"]成为
plt.rcParams['text.latex.preamble'] = r"\usepackage{bm} \usepackage{amsmath}"https://stackoverflow.com/questions/65645194
复制相似问题