plot line over boxplot using pandas DataFrame

后端 未结 1 1760
臣服心动
臣服心动 2020-12-18 06:28

I have a pandas DataFrame with 16 columns corresponding years (2000 to 2015) and 12 lines with values for each month.

I\'m trying plot a boxplot and a line with 2015

相关标签:
1条回答
  • 2020-12-18 07:12

    Thank you so much, pbreach.

    It works to me.

    I made:

    import pandas as pd
    import matplotlib.pyplot as plt
    
    df = pd.read_excel('hidro_ne.xlsx')
    
    fig, ax = plt.subplots()
    ax.plot(list(range(1,13)), df[2015].values, 'r', linewidth=2)
    ax.legend(['2015'])
    df.T.plot.box(yticks=range(0, 105, 5), ax=ax)
    

    0 讨论(0)
提交回复
热议问题