0

I have dataframe and would like to plot the histogram for 2 variables. Below syntax gives the required plot however labels do not appear. Any help would appreciate.

colors = ['tan', 'lime']
labels = ['Score 1','Score 2']
plt.hist([test.score_1,test.score_2],bins = 10,histtype='bar',color=colors, label=labels)

Here is the plot enter image description here

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
William
  • 1
  • 1
  • You can call `plt.legend(labels=labels)` after `plt.hist`. – JohanC Sep 20 '21 at 10:27
  • Does this answer your question? [Adding a legend to PyPlot in Matplotlib in the simplest manner possible](https://stackoverflow.com/questions/19125722/adding-a-legend-to-pyplot-in-matplotlib-in-the-simplest-manner-possible) – Trenton McKinney Sep 20 '21 at 17:49

0 Answers0