字体中的【family】【serif】【sans-serif】

字体中的【family】【serif】【sans-serif】

Matplotlib 中, font.familyfont.seriffont.sans-serif 是控制字体显示的三个核心参数

在matplotlib库中, 通常有关于familyserifsans-serif的字体设置, 以下是它们的一些区别与联系

font-family

决定我们用那种风格的字体, 为指定绘图时默认使用的字体类别, 例如宋体, 楷体, Times New Roman

该值可设置为特定的名称(Times New RomanArialSimSun), 也可设置为通用字体族名(sans-serifserif)

常用值有:

  1. 'serif':衬线体. 笔画末端有装饰(如 Times New Roman, 宋体), 适合正式文档、论文;
  2. 'sans-serif':无衬线体. 笔画末端平整(如 Arial, Helvetica, 黑体), 适合屏幕显示、PPT;
  3. 'monospace':等宽字体. 每个字符宽度相同(如 Courier New), 适合代码展示;
  4. 'cursive' / 'fantasy':手写体或艺术体(较少用).

📜 font.serif (衬线体候选列表)

衬线字体的特点是字母末端有一些额外的细节, 在字符的主要笔画的末尾,有称为衬线的小粗笔
  1. 作用:定义当 font.family 设为 'serif' 时, 具体尝试哪些字体;
  2. 格式:一个列表 ['字体A', '字体B', '字体C', ...].

🚫 font.sans-serif (无衬线体候选列表)

同上

列表对比

参考链接

CSS Fonts(字体) | 菜鸟教程

HTML 字体 -- CSS 字体系列示例(Serif 和 Sans Serif 字符) | w3cschool笔记

font.sans-serif 和 font.family-CSDN博客

(17 封私信 / 80 条消息) Serif Font 与 Sans-serif Font 的差异详解及实际应用 - 知乎

相关推荐
绛橘色的日落(。・∀・)ノ1 天前
Matplotlib 第四章 文字图例尽眉目
matplotlib
喝凉白开都长肉的大胖子2 天前
在 Matplotlib 中fontweight一般怎么设置
python·matplotlib
绛橘色的日落(。・∀・)ノ2 天前
Matplotlib 第三章 布局格式定方圆
matplotlib
绛橘色的日落(。・∀・)ノ3 天前
Matplotlib 第二章 艺术画笔见乾坤
matplotlib
MediaTea7 天前
人工智能通识课:Matplotlib 绘图基础
人工智能·matplotlib
SCBAiotAigc9 天前
2026.3.29:下载|JetBrainsMono字体
字体·visual studio·具身智能
MediaTea9 天前
Matplotlib 常用函数手册
matplotlib
badhope14 天前
Matplotlib实战30例:全类型图表代码库
人工智能·python·plotly·github·matplotlib
badhope14 天前
最小二乘与最速下降法实战解析
人工智能·机器学习·plotly·github·matplotlib