Matplotlib/seaborn histogram using different colors for grouped bins

前端 未结 4 1421
谎友^
谎友^ 2021-01-12 16:09

I have this code, using a pandas df:

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os


path_to = \'Data\\\\2017-04\\\\Mon         


        
4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-12 16:22

    I recommend you to use the plt.hist() function 3 times, each with a different color. You can set the range of each histogramm using the range parameter of the function. The legend is genereated by using the label parameter followed by a subsequent call of plt.legend().

提交回复
热议问题