python matplotlib: label in histogram
37,724
you need to add a legend. See legend for details.
plt.legend()
Author by
Edamame
Updated on December 19, 2020Comments
-
Edamame over 3 years
I am using Python (3.4) Jupyter Notebook. I tried to plot a histogram with label using the code below.
%matplotlib notebook import matplotlib.pyplot as plt import matplotlib import numpy as np bins = np.linspace(0, 1.0, 40) plt.hist(good_tests, bins, alpha = 0.5, color = 'b' , label = 'good') plt.show()
But the label 'good' doesn't show at all. Did I miss anything? Thanks!