# KeyError: 'font.size'不是有效的rc参数。请参阅rcParams.keys()获取有效参数。

- **ID:** `python/matplotlib-rcparams-typo-error`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

rcParams键拼写错误；正确的键是'font.size'，但用户可能拼写为'font.szie'或'fontsize'。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.7 | active | — | — |
| 3.8 | active | — | — |

## 解决方案

1. **Use the exact key from documentation** (95% 成功率)
   ```
   plt.rcParams['font.size'] = 12
   ```
2. **List all rcParams to find the correct spelling** (90% 成功率)
   ```
   print([key for key in plt.rcParams.keys() if 'font' in key])
   ```

## 无效尝试

- **Using 'fontsize' without dot** — The key must have a dot separating group and property; 'fontsize' is not valid. (90% 失败率)
- **Using 'Font.size' with capital letters** — Keys are case-sensitive; 'Font.size' is not valid. (85% 失败率)
