plot multiple pandas dataframes in one graph

后端 未结 2 819
天涯浪人
天涯浪人 2020-12-15 09:30

I have created 6 different dataframes that eliminate the outliers of their own original data frames. Now, I\'m trying to plot all of the dataframes that eliminate the outlie

相关标签:
2条回答
  • 2020-12-15 09:59

    Am I missing something? Normally, I just do this for multiple dataframes:

    fig = plt.figure()
    
    for frame in [newdf, newdf2, newdf3, newdf4, newdf5]:
        plt.plot(frame['Time'], frame['Data'])
    
    plt.xlim(0,18000)
    plt.ylim(0,30)
    plt.show()
    
    0 讨论(0)
  • 2020-12-15 09:59

    You need to use the ax parameter in pandas.dataframe.plot.

    Use on the first df.plot to grab a handle on that axes:

    ax = newdf.plot() 
    

    then on subsequent plots use the ax parameter.

    newdf2.plot(ax=ax)
    ...
    newdf5.plot(ax=ax)
    
    0 讨论(0)
提交回复
热议问题