Dec-23-2020, 06:58 PM
# -*- coding: utf-8 -*- """ Created on Wed Dec 23 11:59:48 2020 @author: drkle """ import matplotlib.pyplot as plt import collections markets = ['ES', 'GC', 'CL', 'EC', 'US'] axL_index = collections.OrderedDict() axR_index = collections.OrderedDict() axL_index[1] = 0; axL_index[2] = 0; axL_index[3] = 1 axL_index[4] = 1; axL_index[5] = 2; axL_index[6] = 2 axR_index[1] = 0; axR_index[2] = 1; axR_index[3] = 0 axR_index[4] = 1; axR_index[5] = 0; axR_index[6] = 1 fig, ax = plt.subplots(3,2,sharex=True) if len(markets) % 2 != 0: fig.delaxes(ax[axL_index[next(reversed(axL_index))],axR_index[next(reversed(axR_index))]]) fig.autofmt_xdate()This deletes the [sixth] subplot in the bottom right, but it takes the x-axis labels in this column along with it. I shared the x-axis labels because the x-axis (time) is the same for all six plots and they only need to be shown at the bottom of every column. How can I preserve that--or do they somehow need to be redrawn below the subplot in row 1 (zero-indexed) column 1?