I have a question about an error I receive when looping to plot multiple subplots from a data frame.
My data frame has many columns, of which I loop over to have a subplot of each column.
This is my code
for i in df:
fig, ax = plt.subplots(len(channels), sharex=True, figsize=(50,100))
for j in df:
ax[plot].plot(df["%s" % j])
ax[plot].set_xlabel('%s' % j)
I get the plot produced fine, but also an empty frame and the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\AClayton\WinPython-64bit-18.104.22.168\python-2.7.5.amd64\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 538, in runfile
File "C:/Users/AClayton/Desktop/Data/TS.py", line 67, in <module>
File "C:/Users/AClayton/Desktop/Data/TS.py", line 49, in plot
ax[plot].plot(reader["%s" % j])
TypeError: 'AxesSubplot' object does not support indexing
I can't see where this error comes from if the first plot is produced fine, or why the second figure is produced?