Elffuss BraidHub

kikocis/auto-code-rover public

main · 1.3 KiBRawPermalink
1[Bug]: Constrained layout UserWarning even when False
2### Bug summary
3
4When using layout settings such as `plt.subplots_adjust` or `bbox_inches='tight`, a UserWarning is produced due to incompatibility with constrained_layout, even if constrained_layout = False. This was not the case in previous versions.
5
6### Code for reproduction
7
8```python
9import matplotlib.pyplot as plt
10import numpy as np
11a = np.linspace(0,2*np.pi,100)
12b = np.sin(a)
13c = np.cos(a)
14fig,ax = plt.subplots(1,2,figsize=(8,2),constrained_layout=False)
15ax[0].plot(a,b)
16ax[1].plot(a,c)
17plt.subplots_adjust(wspace=0)
18```
19
20
21### Actual outcome
22
23The plot works fine but the warning is generated
24
25`/var/folders/ss/pfgdfm2x7_s4cyw2v0b_t7q80000gn/T/ipykernel_76923/4170965423.py:7: UserWarning: This figure was using a layout engine that is incompatible with subplots_adjust and/or tight_layout; not calling subplots_adjust.
26 plt.subplots_adjust(wspace=0)`
27
28### Expected outcome
29
30no warning
31
32### Additional information
33
34Warning disappears when constrained_layout=False is removed
35
36### Operating system
37
38OS/X
39
40### Matplotlib Version
41
423.6.0
43
44### Matplotlib Backend
45
46_No response_
47
48### Python version
49
50_No response_
51
52### Jupyter version
53
54_No response_
55
56### Installation
57
58conda