# Label plot lines in matplotlib

> Use plt.legend() to show the labels.

- Canonical: https://preview.arshadmehmood.com/today-i-learned/python/label-plot-lines-in-matplotlib/
- Section: python
- Author: Arshad Mehmood

Use `plt.legend()` to show the labels.

```python
plt.plot(x_A,y_A,'g--', label="plot A")
plt.plot(x_B,y_B,'r-o', label="plot A")
plt.legend()
plt.show()
```

