【摘要】 FontProperties类概述
FontProperties类用于存储和操作字体的属性。matplotlib支持的字体属性基于W3C Cascading Style Sheet, Level 1 font specification,主要有以下6个:字体类别(family)、字体风格(style)、字体粗细(weight)、字体大小(size)、字体拉伸(stre…
FontProperties
类概述
FontProperties
类用于存储和操作字体的属性。matplotlib
支持的字体属性基于W3C Cascading Style Sheet, Level 1 font specification
,主要有以下6个:字体类别(family)、字体风格(style)、字体粗细(weight)、字体大小(size)、字体拉伸(stretch)和字体变体(variant)。
FontProperties
类签名为:class matplotlib.font_manager.FontProperties(family=None, style=None, variant=None, weight=None, stretch=None, size=None, fname=None, math_fontfamily=None)
FontProperties
类构造函数参数分为:其中字体的6种属性的初始取值均来自对应的rcParams
参数。
-
family
:字体类别。取值范围为{ 'sans-serif' , 'serif', 'cursive', 'fantasy', 'monospace'}
,默认值为'sans-serif'
。每个取值都代表一类字体,在matplotlib
中对应数据结构为字体列表,优先级按位置递减。每次在使用时,matplotlib
会根据rcParams
根据字体类别和优先级确定某字体。family 解释 sans-serif 无衬线体 serif 衬线体 cursive 手写体 fantasy 符号字体 monospace 等宽字体 © 版权声明文章版权归作者所有,未经允许请勿转载。THE END