If plotting duplicates in a loop the axes are not updated. So, if on the next image the number of the duplicates is less, than the previous one, it will contain the axes from the previous image. Unfortunately, I can't provide examples due to NDA.
To solve this bug, you should change
fig = figure.Figure(figsize=(10, 14))
to
fig, ax = plt.subplots(figsize=(10, 14))
If plotting duplicates in a loop the axes are not updated. So, if on the next image the number of the duplicates is less, than the previous one, it will contain the axes from the previous image. Unfortunately, I can't provide examples due to NDA. To solve this bug, you should change
fig = figure.Figure(figsize=(10, 14))
tofig, ax = plt.subplots(figsize=(10, 14))