Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a158469

Browse files
committed
Clarify keyword argument in error message
GridSpec has a `figure` keyword argument, not a `fig` keyword argument. The error message can be produced using a snippet like the following: from matplotlib.figure import Figure from matplotlib.gridspec import GridSpec fig = Figure(constrained_layout=True) gs = GridSpec(1, 1) ax = fig.add_subplot(gs[0]) ax.plot([0, 1], [0, 1]) fig.savefig("temp.svg")
1 parent f7ae157 commit a158469

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2591,7 +2591,7 @@ def execute_constrained_layout(self, renderer=None):
25912591
cbook._warn_external("Calling figure.constrained_layout, but "
25922592
"figure not setup to do constrained layout. "
25932593
" You either called GridSpec without the "
2594-
"fig keyword, you are using plt.subplot, "
2594+
"figure keyword, you are using plt.subplot, "
25952595
"or you need to call figure or subplots "
25962596
"with the constrained_layout=True kwarg.")
25972597
return

0 commit comments

Comments
 (0)