How can I plot separate Pandas DataFrames as subplots?

后端 未结 9 2021
离开以前
离开以前 2020-11-22 17:00

I have a few Pandas DataFrames sharing the same value scale, but having different columns and indices. When invoking df.plot(), I get separate plot images. what

9条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 17:50

    You may not need to use Pandas at all. Here's a matplotlib plot of cat frequencies:

    x = np.linspace(0, 2*np.pi, 400)
    y = np.sin(x**2)
    
    f, axes = plt.subplots(2, 1)
    for c, i in enumerate(axes):
      axes[c].plot(x, y)
      axes[c].set_title('cats')
    plt.tight_layout()
    

提交回复
热议问题