To center align the bottom plots, you can modify the subplot positioning to leave the middle column empty in the bottom row. Here's the modified code:
# use gridspec to create a grid layout for the plots
fig = plt.figure(figsize=(28, 18))
gs = gridspec.GridSpec(2, 3, figure=fig)
ax1 = fig.add_subplot(gs[0, 0])
ax1.plot(range(60), nn_rmse[0:60], label='RMSE', color='tab:red')
ax2 = ax1.twinx()
ax2.plot(range(60), nn_conf_mean[0:60], label='Confidence Loss Value', color='tab:blue')
ax1.set_xlabel('Level Index')
ax1.set_ylabel('RMSE', color='tab:red')
ax2.set_ylabel('Confidence Loss value', color='tab:blue')
ax1.tick_params(axis='y', labelcolor='tab:red')
ax2.tick_params(axis='y', labelcolor='tab:blue')
ax1.set_title('NN RMSE and Confidence Loss (dT/dt)')
ax3 = fig.add_subplot(gs[0, 1])
ax3.plot(range(60), nn_rmse[60:120], label='RMSE', color='tab:red')
ax4 = ax3.twinx()
ax4.plot(range(60), nn_conf_mean[60:120], label='Confidence Loss Value', color='tab:blue')
ax3.set_xlabel('Level Index')
ax3.set_ylabel('RMSE', color='tab:red')
ax4.set_ylabel('Confidence Loss value', color='tab:blue')
ax3.tick_params(axis='y', labelcolor='tab:red')
ax4.tick_params(axis='y', labelcolor='tab:blue')
ax3.set_title('NN RMSE and Confidence Loss (dQv/dt)')
ax5 = fig.add_subplot(gs[0, 2])
ax5.plot(range(60), nn_rmse[120:180], label='RMSE', color='tab:red')
ax6 = ax5.twinx()
ax6.plot(range(60), nn_conf_mean[120:180], label='Confidence Loss Value', color='tab:blue')
ax5.set_xlabel('Level Index')
ax5.set_ylabel('RMSE', color='tab:red')
ax6.set_ylabel('Confidence Loss value', color='tab:blue')
ax5.tick_params(axis='y', labelcolor='tab:red')
ax6.tick_params(axis='y', labelcolor='tab:blue')
ax5.set_title('NN RMSE and Confidence Loss (dQn/dt)')
# Center-aligned bottom plots: use columns 0 and 2, leave column 1 empty
ax7 = fig.add_subplot(gs[1, 0])
ax7.plot(range(60), nn_rmse[180:240], label='RMSE', color='tab:red')
ax8 = ax7.twinx()
ax8.plot(range(60), nn_conf_mean[180:240], label='Confidence Loss Value', color='tab:blue')
ax7.set_xlabel('Level Index')
ax7.set_ylabel('RMSE', color='tab:red')
ax8.set_ylabel('Confidence Loss value', color='tab:blue')
ax7.tick_params(axis='y', labelcolor='tab:red')
ax8.tick_params(axis='y', labelcolor='tab:blue')
ax7.set_title('NN RMSE and Confidence Loss (dU/dt)')
ax9 = fig.add_subplot(gs[1, 2]) # Changed from gs[1, 1] to gs[1, 2]
ax9.plot(range(60), nn_rmse[240:300], label='RMSE', color='tab:red')
ax10 = ax9.twinx()
ax10.plot(range(60), nn_conf_mean[240:300], label='Confidence Loss Value', color='tab:blue')
ax9.set_xlabel('Level Index')
ax9.set_ylabel('RMSE', color='tab:red')
ax10.set_ylabel('Confidence Loss value', color='tab:blue')
ax9.tick_params(axis='y', labelcolor='tab:red')
ax10.tick_params(axis='y', labelcolor='tab:blue')
ax9.set_title('NN RMSE and Confidence Loss (dV/dt)')
The key change is moving the second bottom plot from gs[1, 1] to gs[1, 2], which positions the two bottom plots in the left and right columns with an empty space in the middle, effectively center-aligning them in the bottom row.