# UserWarning: 未应用紧凑布局。左右边距无法足够大以容纳所有轴装饰。

- **ID:** `python/matplotlib-tight-layout-warning`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

由于过长的刻度标签、过多子图或固定的图形尺寸导致没有足够空间，plt.tight_layout() 无法满足所需的间距。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   fig, axs = plt.subplots(2, 2, constrained_layout=True, figsize=(10, 8))
# or: fig.set_layout_engine('constrained')
   ```
2. **** (85% 成功率)
   ```
   fig, ax = plt.subplots(figsize=(12, 8))
ax.plot([1,2,3])
plt.tight_layout(pad=2.0)
   ```

## 无效尝试

- **** — Repeated calls yield the same constraint violation; the layout engine has no additional space to allocate. (92% 失败率)
- **** — Hides the symptom but the labels are still clipped in the saved figure. (70% 失败率)
