jeudi 19 août 2021

Numpy array not callable error while plotting subplots

I am trying to plot a subplot for random numbers using fig,axes subplots, but getting the error, "numpy array not callable". Please help , i have no clue why it is giving an error i am new to python and data visualization.

a=list(np.random.randn(500))
fig,axes=plt.subplots(5,2,sharex=False,sharey=False)
for i in range(5):
    for j in range(2):
        axes(i,j).hist(a, bins=50, color='k', alpha=0.5)
plt.subplots_adjust(wspace=0, hspace=0)

TypeError                                 Traceback (most recent call last)
<ipython-input-18-1a7805305e69> in <module>
      3 for i in range(5):
      4     for j in range(2):
----> 5         axes(i,j).hist(a, bins=50, color='k', alpha=0.5)
      6 plt.subplots_adjust(wspace=0, hspace=0)

TypeError: 'numpy.ndarray' object is not callable



Aucun commentaire:

Enregistrer un commentaire