matplotlib.rcsetup
rcsetup 模块包含了使用 Matplotlib 的 rc 设置进行自定义的验证代码。
每个 rc 设置都分配了一个用于验证对该设置的任何尝试更改的函数。验证函数在 rcsetup 模块中定义,并用于构建 rcParams 全局对象,该对象存储设置并在整个 Matplotlib 中引用。
rc 设置的默认值在默认的 matplotlibrc 文件中设置。此处列出的参数集的任何添加或删除也应传播到 Matplotlib 根源目录中的 lib/matplotlib/mpl-data/matplotlibrc
。
-
class matplotlib.rcsetup.ValidateInStrings(key, valid, ignorecase=False, *, _deprecated_since=None)[源代码][源代码]
基类:object
valid 是一个合法字符串的列表。
-
matplotlib.rcsetup.cycler(*args, **kwargs)[源代码][源代码]
创建一个 Cycler
对象,类似于 cycler.cycler()
,但包含输入验证。
调用签名:
cycler(cycler)
cycler(label=values[, label2=values2[, ...]])
cycler(label, values)
表单 1 复制给定的 Cycler
对象。
表单 2 创建了一个 Cycler
,它同时循环遍历一个或多个属性。如果给出了多个属性,它们的值列表必须具有相同的长度。
Form 3 为单个属性创建一个 Cycler
。此形式是为了与原始的 cycler 兼容。建议使用 kwarg 形式,即 cycler(label=values)
,而不是此形式。
- 参数:
- cyclerCycler
Cycler 的复制构造函数。
- 标签str
属性键。必须是有效的 Artist
属性。例如,'color' 或 'linestyle'。允许使用别名,例如 'c' 代表 'color','lw' 代表 'linewidth'。
- 值可迭代对象
属性值的有限长度可迭代对象。这些值会被验证,如果无效则会引发 ValueError。
- 返回:
- Cycler
一个新的 Cycler
用于给定的属性。
示例
为一个属性创建一个循环器:
>>> c = cycler(color=['red', 'green', 'blue'])
创建一个同时循环多个属性的循环器(例如红色圆圈、绿色加号、蓝色叉号):
>>> c = cycler(color=['red', 'green', 'blue'],
... marker=['o', '+', 'x'])
-
matplotlib.rcsetup.validate_any(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_anylist(s)[源代码]
-
matplotlib.rcsetup.validate_aspect(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_axisbelow(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_backend(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_bbox(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_bool(b)[源代码][源代码]
将 b 转换为 bool
或引发异常。
-
matplotlib.rcsetup.validate_color(s)[源代码][源代码]
返回一个有效的颜色参数。
-
matplotlib.rcsetup.validate_color_for_prop_cycle(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_color_or_auto(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_color_or_inherit(s)[源代码][源代码]
返回一个有效的颜色参数。
-
matplotlib.rcsetup.validate_colorlist(s)[源代码]
返回一个颜色规格列表
-
matplotlib.rcsetup.validate_cycler(s)[源代码][源代码]
从字符串表示或对象本身返回一个 Cycler 对象。
-
matplotlib.rcsetup.validate_dashlist(s)[源代码]
返回一个浮点数列表
-
matplotlib.rcsetup.validate_dpi(s)[源代码][源代码]
确认 s 是字符串 'figure' 或将其转换为浮点数或引发异常。
-
matplotlib.rcsetup.validate_fillstylelist(s)[源代码]
-
matplotlib.rcsetup.validate_float(s)[源代码]
-
matplotlib.rcsetup.validate_float_or_None(s)[源代码]
-
matplotlib.rcsetup.validate_floatlist(s)[源代码]
返回一个浮点数列表
-
matplotlib.rcsetup.validate_font_properties(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_fontsize(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_fontsize_None(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_fontsizelist(s)[源代码]
-
matplotlib.rcsetup.validate_fontstretch(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_fonttype(s)[源代码][源代码]
确认这是一个我们已知如何转换的 Postscript 或 PDF 字体类型。
-
matplotlib.rcsetup.validate_fontweight(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_hatch(s)[源代码][源代码]
验证一个填充图案。一个填充图案字符串可以包含以下任意字符序列:\ / | - + * . x o O
。
-
matplotlib.rcsetup.validate_hatchlist(s)[源代码]
验证一个填充图案。一个填充图案字符串可以包含以下任意字符序列:\ / | - + * . x o O
。
-
matplotlib.rcsetup.validate_hist_bins(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_int(s)[源代码]
-
matplotlib.rcsetup.validate_int_or_None(s)[源代码]
-
matplotlib.rcsetup.validate_markevery(s)[源代码][源代码]
验证 Line2D 对象的 markevery 属性。
- 参数:
- sNone, int, (int, int), slice, float, (float, float), 或 list[int]
- 返回:
- None, int, (int, int), slice, float, (float, float), 或 list[int]
-
matplotlib.rcsetup.validate_markeverylist(s)[源代码]
验证 Line2D 对象的 markevery 属性。
- 参数:
- sNone, int, (int, int), slice, float, (float, float), 或 list[int]
- 返回:
- None, int, (int, int), slice, float, (float, float), 或 list[int]
-
matplotlib.rcsetup.validate_ps_distiller(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_sketch(s)[源代码][源代码]
-
matplotlib.rcsetup.validate_string(s)[源代码]
-
matplotlib.rcsetup.validate_string_or_None(s)[源代码]
-
matplotlib.rcsetup.validate_stringlist(s)[源代码]
返回一个字符串列表
-
matplotlib.rcsetup.validate_whiskers(s)[源代码][源代码]