I'm creating several subplots in matplotlib as:
fig, axes = plt.subplots(2, 2, figsize=(100, 85))
axes = axes.flatten()
'Other code for populating the subplots'
I want to remove the last plot, if it's empty. I tried this code:
if axes[-1] is None:
axes[-1].set_visible(False)
The problem is that the axes elements are object of type AxesSubplot:
print(axes.flat[-1])
AxesSubplot(0.547727,0.125;0.352273x0.343182)
How can I solve the problem?