How to change defaults in matplot lib and find specific list of rc parameters

匆匆过客 提交于 2019-12-02 09:03:46

There is a complete tutorial about rc params: Customizing Matplotlib with style sheets and rcParams.

Further down that tutorial there is a section A sample matplotlibrc file, which contains all valid rc params.

Another option is to just print all rc params out,

print(plt.rcParams)

Concerning the actual question:

  • The grid can be turned on via

    plt.rcParams["axes.grid"] = True
    
  • The figure size can be set via

    plt.rcParams["figure.figsize"] = (8,6)
    

From the documentation, you can find the location of the matplotlibrc on your machine as follows:

import matplotlib
matplotlib.matplotlib_fname()

In your text editor, you can uncomment the preset commands. This file is read whenever matplotlib is imported.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!