1

I am trying to make a figure with a number of stacked subplots. I have the data being generated by a different script (data.main), and am trying to loop through my data and plot it. Here is the code:

def main(files):
    n=len(files)
    fig, ax= plt.subplots(n,1, sharex=True)
    for i in np.arange(n):
        xdata, ydata, yerr, xerr=data.main(files[i])
        ax[i, 1].plot(xdata,ydata, linestyle='none', marker='o')
        ax[i, 1].errorbar(xdata,ydata,yerr,xerr, linestyle='none')
    plt.show()

I get the error

TypeError: 'AxesSubplot' object has no attribute '__getitem__' 

Can anyone help me understand what is going wrong?

Jobo
  • 11
  • 3

0 Answers0