首页 > 解决方案 > matplotlib动画中的参差不齐的字体

问题描述

我无法弄清楚为什么轴标题和刻度标签字体仅在我最近创建的特定 conda 环境(python 3.9)中的动画中看起来很糟糕。

在此处输入图像描述

我在 jupyter 实验室笔记本环境中。上图显示了做的输出

ani = FuncAnimation( ...)
HTML(ani.to_html5_video())

如您所见,第二个图(显示动画的最后一帧)文本字体很好。

但在动画中,文字看起来很粗糙。

我在不同的 conda 环境中拥有的另一个内核不会发生这种情况。

从表面上看,两者在matplotlib rcParams方面并没有什么不同。我还比较了这些 INFO 日志

INFO:matplotlib.animation:MovieWriter._run: running command: ffmpeg -f rawvideo -vcodec rawvideo -s 576x432 -pix_fmt rgba -r 1.0 -loglevel error -i pipe: -vcodec h264 -pix_fmt yuv420p -y /tmp/tmpyk844_02/temp.m4v

并没有什么特别的不同。

这可能是什么原因?

标签: pythonmatplotlibmatplotlib-animation

解决方案


推荐阅读