tight_layout()的替代方案

Ame*_*ina 6 python matplotlib

tight_layout()在matplotlib中调用会导致:RunTimeError: "CGContextRef is NULL".我自己Agg在MacOSX和Linux中遇到了几个后端(包括)的错误.

如果我想达到相同的效果,或希望足够接近,效果,而不会遇到这些错误,我有什么选择?

use*_*537 4

tight_layout()虽然不是同样的问题,但我通过将其添加到脚本的开头来 解决我遇到的问题。

matplotlib.rcParams.update({'figure.autolayout': True})
Run Code Online (Sandbox Code Playgroud)