python-3.x - matplotlib 的自定义 Latex 字体
问题描述
我正在尝试更改 Latex 方程式字体,因此我使用了自定义字体,并且尝试了各种系统字体,但问题是我更改了字体系列,仅更改了数字而不更改字符(在我的示例中为 x 和 y)本身。
from matplotlib import rcParams
from matplotlib import pyplot as plt
import matplotlib
from matplotlib.font_manager import FontProperties
import matplotlib.font_manager
print([f.name for f in matplotlib.font_manager.fontManager.ttflist])
rcParams['mathtext.fontset'] = 'custom'
rcParams['mathtext.rm'] = 'STIXGeneral'
#rcParams['mathtext.rm'] = 'Corbel'
##rcParams['mathtext.rm'] = 'Arial'
matplotlib.rcParams.update({'font.size': 21})
fig, ay = plt.subplots()
plt.title("$x+y=21$")
plt.show()
有什么想法吗?我正在尝试让 Stix2 数学工作。
解决方案
推荐阅读
- python - 我将如何以不同的数量抵消 pandas 的数据列?
- spring-boot - 日志文件名中服务器的端口号 - log4j2
- sql - 在 SQL Server 中动态地将行转换为列
- angular - Angular 日历点击事件
- binary-tree - 没有指针的二叉树
- c++ - 如何在 C++ Actor Framework 中使用 Eigen::Matrix4d 作为消息类型?
- c# - EF Core 按列区分
- net-snmp - 如何配置引擎 ID 以使用 SNMP4J 发送 SNMP 陷阱 V3?
- angular - 在动态角度表上应用日期管道
- json - Angular 7 - 有没有办法在 Angular 应用程序离线时加载/导入 json 文件?