I'm trying to plot 2 different data sets but I don't know how to fix the subplot (if i put 2,2 it works but if i try anything else it gives me an error)
fig, axs = plt.subplots(nrows=2, ncols=1)
axs[0,1].plot(adj_close['SOL-USD'])
axs[2,1].set_title('SOL')
plt.show()
error:
----> 6 axs[0,0].plot(adj_close['SOL-USD'])
7 axs[0,0].set_title('SOL')
8 axs[0,1].plot(adj_close['ETH-USD'])
TypeError: 'AxesSubplot' object is not subscriptable
IndexError Traceback (most recent call last)
Input In [356], in <cell line: 3>()
1 #ploting the histogram
2 fig, axs = plt.subplots(2,1,figsize=(16,8),gridspec_kw ={'hspace': 0.2, 'wspace': 0.1})
----> 3 axs[0,0].hist(returns['SOL-USD'], bins=50, range=(-0.2, 0.2))
4 axs[0,0].set_title('SOL')
5 axs[1,0].hist(returns['ETH-USD'], bins=50, range=(-0.2, 0.2))
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
what it currently looks like with subplot 2,2:

axsis a typo foraxes, or meant to refer to a different variable not shown; and the error message clearly shows code that doesn't reflect the code in the example. (Also, please try to ask a question instead of just showing code and an error.)plt.subplots(nrows=2, ncols=1)toplt.subplots(nrows=2, ncols=2)it gets graphed :(axsget defined, then?fig, axs = plt.subplots(2,2,figsize=(16,8),gridspec_kw ={'hspace': 0.2, 'wspace': 0.1})