Help on subplots: my first subplot now showing

Hi, there. I am trying to make subplots using for loop as below. However, the first plot is not shown.

def ts_plot(var,cluster,ax,i):
    i_var = convert_var_list.index(var)
    var_name = var_name_list[i_var]
    unit = unit_list[i_var]
    df = df_1h
    df_plot = df.loc[df_1h.Cluster ==f'{cluster}'] 
    time_start = '2022-11-06 12:00:00'
    time_end = '2022-11-14 12:00:00'
    bp = df_plot.groupby('Location')[f'{var}'].plot(kind='line',ax=ax)

for var in convert_var_list[0:1]:
    i = 0
    rows, cols = 6, 1
    fig, axs = plt.subplots(rows, cols,figsize = (8,10),sharex=True)
    for cluster in cluster_list[:]:
        # Adding a title to the figure
        fig.suptitle(f'{var}', x=0.5, y=0.90, fontsize=14, fontweight ='bold')

If I change the colde “for cluster in cluster_list[:]:” to “for cluster in cluster_list[0:1]:” I will get the first plot but when changing back, it’s gone . Can’f figure out why and how to make all plots shown. Any suggestion is highly appreciated.

can be written as

    for i, cluster in enumerate(cluster_list[:]):

to prevent accidental changes of i.

But it’s hard to say much more without a self-contained example.

Thanks for your suggestion, it makes the code pretty. The error is still there, unfortunately. Will try other ways out.

The xticks are different in the two examples so I’m not 100% what is going on there.

There is a legend in the top axes which suggests that the data actually was plotted, but is not visible. Are you sure the x-range of all of the data is the same?