I have two 2d arrays that store data and I want to make a subplot in matplotlib consisting of two boxplots, however, I am encountering the error above whenever I try to put the two boxplots into a subplot. Each 2d array is m rows x n columns in dimension and for each array I draw one boxplot so that each column gets its own box within their respective boxplot. Drawing the boxplot works fine, but when I try to make a subplot containing the two boxplots, I get IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
. From the way it's worded I think it may be because of me using 2d arrays but I'm not sure. Am I filling the data incorrectly or something?
code:
cols = [0, 1, 2, 3, 4]
repeats = np.linspace(0, 49, 50)
array1 = np.zeros((len(repeats), len(cols))) # stores a numerical data value in each space
array2 = np.zeros((len(repeats), len(correl)))
#for i in range(len(cols)):
for j in range(len(repeats)): #data for array1 and array2 generated here
pass
fig3, axs = plt.subplots(1, 2)
axs[0, 0] = plt.boxplot(array1, labels = cols)
axs[0, 1] = plt.boxplot(array1, labels = cols)