对于matplotlib绘图区总是有比较强迫症的自定义要求,对于刚刚接触Python的新手来说,各种配置起来还是比较繁琐,因此开一个帖子作为注记备忘。(Jupyter-Based)
A class for storing and manipulating font properties.
The font properties are the six properties described in the W3C Cascading Style Sheet, Level 1 font specification and math_fontfamily for math fonts:
family: A list of font names in decreasing order of priority. The items may include a generic font family name, either 'sans-serif' (default), 'serif', 'cursive', 'fantasy', or'monospace'. In that case, the actual font to be used will be looked up from the associated rcParam.
style: Either 'normal' (default), 'italic' or 'oblique'.
variant: Either 'normal' (default) or 'small-caps'.
stretch: A numeric value in the range 0-1000 or one of 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal' (default), 'semi-expanded', 'expanded', 'extra-expanded' or 'ultra-expanded'.
weight: A numeric value in the range 0-1000 or one of 'ultralight', 'light', 'normal' (default), 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'.
size: Either an relative value of 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' or an absolute font size, e.g., 10 (default).
用户希望自定义字体,即分别设置中文、英文、数学公式的字体,由于这里采用字体融合的应用将中英文混合,通过导入ttf文件以满足自定义配置的要求。(好看的图片,流程比较繁琐)