Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternatives to tight_layout()

Calling tight_layout() in matplotlib can lead to: RunTimeError: "CGContextRef is NULL". I have suffered from this error myself with several backends (including Agg) in MacOSX and Linux.

If I want to achieve the same, or hopefully close enough, effect, without running into these errors, what are my options?

like image 209
Amelio Vazquez-Reina Avatar asked Jul 09 '14 22:07

Amelio Vazquez-Reina


1 Answers

While not the same problem, I worked around issues I was having with tight_layout() by adding this to the start of my script instead.

matplotlib.rcParams.update({'figure.autolayout': True})
like image 135
user3419537 Avatar answered Oct 14 '22 08:10

user3419537