如何在Matplot lib中更改默认值并找到rc参数的特定列表 [英] How to change defaults in matplot lib and find specific list of rc parameters
问题描述
此刻我正在学习matplotlib并致力于更改rcParams.网站上的文档似乎非常稀疏.
I am learning matplotlib at the moment and working on changing the rcParams. The documentation on the website appears to be very sparse.
当我此处时,仅有少数几个可以更改的rc参数示例,主要是字体或线条颜色,例如:
When I look here, there is only a select few examples of rc parameters that can be changed, mainly fonts or line colors, such as:
rcParams['lines.linewidth'] = 2
rcParams['lines.color'] = 'r'
以此类推.我正在寻找改变网格和默认图形大小的方法,例如,但它们未在此处列出,而仅散布在整个网络中.我想找到 all 可变参数及其说明的参考列表.是否存在这样的引用?
And so forth. I am looking for ways to alter the grid and default figure size for example, but they are not listed here and are only scattered here and there across the web. I want to find a reference list of all the changeable parameters and their descriptions. Does such a reference exist?
谢谢.
推荐答案
There is a complete tutorial about rc params: Customizing Matplotlib with style sheets and rcParams.
在该教程的下半部分有示例matplotlibrc文件,其中包含所有有效的rc参数.
Further down that tutorial there is a section A sample matplotlibrc file, which contains all valid rc params.
另一种选择是只打印所有rc参数,
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)
这篇关于如何在Matplot lib中更改默认值并找到rc参数的特定列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!