Skip to content

Commit 8d2fd25

Browse files
committed
tweak tight layout application to try and reduce warnings
1 parent 53c5e4d commit 8d2fd25

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fooof/plts/style.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,10 @@ def apply_custom_style(ax, **kwargs):
169169
ax.legend(prop={'size': kwargs.pop('legend_size', LEGEND_SIZE)},
170170
loc=kwargs.pop('legend_loc', LEGEND_LOC))
171171

172-
plt.tight_layout()
172+
# Apply tight layout to the figure object
173+
# This should be equivalent to `plt.tight_layout()`, but seems to raise fewer warnings...
174+
fig = plt.gcf()
175+
fig.set_layout_engine('tight')
173176

174177

175178
def apply_style(ax, axis_styler=apply_axis_style, line_styler=apply_line_style,

0 commit comments

Comments
 (0)