Math 如何在matplotlib的数学代码段中获取Helvetica字体?

Math 如何在matplotlib的数学代码段中获取Helvetica字体?,math,fonts,matplotlib,Math,Fonts,Matplotlib,我想在Helvetica/Arial matplotlib标签中写入$\eta=a^2$。我认为有两种可能性: u“η${}=a^2$” matplotlib.rc("font", **{"sans-serif": ["Arial"], "size": fontsize}) matplotlib.rc("font", **{"sans-serif": ["Arial"], "size": fontsize}) matplotlib.rc("text", usetex=True) matplot

我想在Helvetica/Arial matplotlib标签中写入
$\eta=a^2$
。我认为有两种可能性:

  • u“η${}=a^2$”

    matplotlib.rc("font", **{"sans-serif": ["Arial"], "size": fontsize})
    
    matplotlib.rc("font", **{"sans-serif": ["Arial"], "size": fontsize})
    matplotlib.rc("text", usetex=True)
    matplotlib.rc("text.latex", preamble=["\\usepackage{helvet}\\usepackage{sfmath}"])
    
  • u“$\\eta=a^2$”

    matplotlib.rc("font", **{"sans-serif": ["Arial"], "size": fontsize})
    
    matplotlib.rc("font", **{"sans-serif": ["Arial"], "size": fontsize})
    matplotlib.rc("text", usetex=True)
    matplotlib.rc("text.latex", preamble=["\\usepackage{helvet}\\usepackage{sfmath}"])
    

  • 在第一种情况下,所有数学都有标准的CM字体。在第二种情况下,η为标准CM字体。真倒霉有没有办法在Helvetica/Arial中获取所有内容?

    在第一个选项中,只需将以下内容添加到“字体”字典中:

    'style':'normal'
    'family':'sans'