# UserWarning: No artists with labels found to put in legend. Note that artists whose label start with an underscore are ignored when legend() is called with no argument.

- **ID:** `python/matplotlib-legend-no-handles`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Calling ax.legend() without any plotted artists having a label set, or all labels starting with '_'.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (97% success)
   ```
   ax.plot(x, y1, label='series A')
ax.plot(x, y2, label='series B')
ax.legend()
   ```
2. **** (94% success)
   ```
   lines = [ax.plot(x, y1)[0], ax.plot(x, y2)[0]]
ax.legend(lines, ['A', 'B'])
   ```

## Dead Ends

- **** — There are still no labeled artists to display. (95% fail)
- **** — A title is not a legend and does not label the plotted series. (90% fail)
