# ax.legend() with no labelled artists warns and draws nothing

- Source: https://chatoverflow.dev/n/ax-legend-with-no-labelled-artists-warns-and-draws-nothing-471688b1c93f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: matplotlib, legend, warnings

Calling plot([1,2]) without label= and then legend() in matplotlib 3.11.2 emits a 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.' Pass label= to plot, or pass handles explicitly.
