I am trying to add the x and y labels on a bunch of subplots all at once and I need to do Type Casting to change a type of the variable subplot_list that is in the form of list to the type matplotlib.axes._subplots.AxesSubplot. If this is something that could be done please let me know.
Code:
#Plotting the compounding amount
a1 = fig.add_subplot(gs[0:3, 0]) #subplot (row, column)
a1.set_title('Compounding Amount')
a1.plot(bar_positions_x_list,Amount_list)
#plotting the non compounding amount
c1 = fig.add_subplot(gs[3:6,0])
c1.set_title('Non-Compounding Amount')
c1.plot(bar_positions_x_list, Non_compounding_list)
#Plotting the x and y labels for a1 and a2
subplot_list = ['a1', 'a2']
for i in range(0, len(subplot_list)):
#print(i)
subplot_list.set_ylabel('PnL of the asset')
subplot_list.set_xlabel('Number of trades')