Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 更改matplotlib中记号标签的字体_Python 2.7_Matplotlib - Fatal编程技术网

Python 2.7 更改matplotlib中记号标签的字体

Python 2.7 更改matplotlib中记号标签的字体,python-2.7,matplotlib,Python 2.7,Matplotlib,如何更改matplotlib记号标签的字体?我想把它改成Computer Modern 10(我相信在matplotlib中称为“cm”),但是,我不想用TeX渲染它。我尝试了很多方法,但似乎都不管用 func = lambda x, pos: "" if np.isclose(x,0) else x plt.gca().xaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(func)) plt.gca().yaxis.set_maj

如何更改matplotlib记号标签的字体?我想把它改成Computer Modern 10(我相信在matplotlib中称为“cm”),但是,我不想用TeX渲染它。我尝试了很多方法,但似乎都不管用

func = lambda x, pos: "" if np.isclose(x,0) else x
plt.gca().xaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(func))
plt.gca().yaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(func))
在我的情况下有效

在我的情况下有效

这只是,与更改字体无关。这只是,与更改字体无关。