0

I have a list of NumPy arrays given below

score_list=[[**0.9442483660130718**, 0.957908496732026, 0.9499346405228758, 
0.9475163398692809, 0.6247058823529412, 0.9475816993464052], 
[**0.9420261437908496**, 0.9638562091503268, 0.9407189542483659, 0.9415686274509802, 
0.6270588235294118, 0.951111111111111], 
[**0.9396078431372549**, 0.9602614379084967, 0.9451633986928104, 0.9486928104575162, 
0.6271241830065359, 0.9534640522875816], 
[**0.944313725490196**, 0.960326797385621, 0.9404575163398691, 0.9485620915032679, 
0.6235947712418302, 0.9487581699346406], 
[**0.9431372549019608**, 0.9591503267973855, 0.9452287581699346, 0.9523529411764704, 
0.6270588235294118, 0.9511111111111111], 
[**0.9384967320261437**, 0.9614379084967319, 0.9463398692810456, 0.9486928104575163, 
0.6247058823529412, 0.9546405228758169], 
[**0.9454901960784313**, 0.9615686274509803, 0.9452287581699345, 0.9486928104575163, 
0.6224183006535948, 0.9534640522875816], 
[**0.9407189542483659**, 0.9591503267973855, 0.9428104575163396, 0.9475816993464052, 
0.6258823529411766, 0.9534640522875816], 
[**0.9442483660130719**, 0.9661437908496733, 0.9439869281045752, 0.9415686274509802, 
0.6235947712418302, 0.9569934640522875], 
[**0.9442483660130718**, 0.9580392156862745, 0.9440522875816992, 0.9474509803921568, 
0.6247712418300654, 0.951111111111111]]

I converted the Numpy array to a dataframe to get:

       0         1         2         3         4         5
0  0.944248  0.957908  0.949935  0.947516  0.624706  0.947582
1  0.942026  0.963856  0.940719  0.941569  0.627059  0.951111
2  0.939608  0.960261  0.945163  0.948693  0.627124  0.953464
3  0.944314  0.960327  0.940458  0.948562  0.623595  0.948758
4  0.943137  0.959150  0.945229  0.952353  0.627059  0.951111
5  0.938497  0.961438  0.946340  0.948693  0.624706  0.954641
6  0.945490  0.961569  0.945229  0.948693  0.622418  0.953464
7  0.940719  0.959150  0.942810  0.947582  0.625882  0.953464
8  0.944248  0.966144  0.943987  0.941569  0.623595  0.956993
9  0.944248  0.958039  0.944052  0.947451  0.624771  0.951111

This is my python code:

sizes = np.arange(10,110,10)
plt.plot(sizes, score_list, 'o-', color="blue", label="Scores",
     linestyle = '--')

plt.legend()
plt.show()

The code is plotting all the arrays on a single plot (see pictureenter image description here

I want to generate a line plot for each array in the list such that the value in the first position of each array is plotted on the first figure in the subplot (as bolded in the numpy array). Also, the value in the second position of each array is plotted in the second figure in the subplot, and others as well. For instance, in the attached image, I want to plot each line on subplots(2,3), all in a figure.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • I think you have mixed up the definitions of `subplot` and `figure`. In matplotlib, a `figure` can have multiple `subplots` (or `axes`), but a `subplot` cannot be on more than one `figure` – tmdavison Sep 15 '21 at 14:40
  • Thanks for your comment. Yes, that was a mix up. It's multiple subplots on a figure. Please how can plot the arrays above using subplots in a figure? Please help out. – OMOMULE KEHINDE Sep 15 '21 at 15:04
  • `ax = df.plot(subplots=True, layout=(3, 2), figsize=(10, 6))` or `ax = df.T.plot(subplots=True, layout=(5, 2), figsize=(10, 6))`. – Trenton McKinney Sep 15 '21 at 17:41

0 Answers0