'matplotlib label doesn't work

When I execute the following code, it doesn't produce a plot with a label.

import matplotlib.pyplot as plt
import numpy as np
x = np.arange(1, 5)
plt.plot(x, x*1.5, label='Normal')

Numpy version is '1.6.2' Matplotlib version is '1.3.x'

Any ideas as to why this is happening?



Solution 1:[1]

You forgot to display the legend:

...
plt.legend(loc='best')
plt.show()

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mechanical_meat