# AttributeError: 'NoneType' object has no attribute 'plot'

- **ID:** `python/matplotlib-nonetype-axes`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Calling ax.plot() on a variable that is None, often because plt.subplots() was called incorrectly or the axes object was not properly extracted.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.7 | active | — | — |
| 3.8 | active | — | — |

## Workarounds

1. **Ensure plt.subplots() returns two values and unpack correctly** (95% success)
   ```
   fig, ax = plt.subplots(); ax.plot([1,2,3])
   ```
2. **Check if ax is None before plotting** (90% success)
   ```
   fig, ax = plt.subplots(); if ax is not None: ax.plot([1,2,3])
   ```

## Dead Ends

- **Checking if the variable name is misspelled** — The issue is not a typo but that the function returned None; misspelling would raise NameError. (60% fail)
- **Reinstalling matplotlib** — This is a code logic error, not a library installation issue. (95% fail)
