check if axis object is empty code example
Example: check if axis object is empty
fig = plt.figure()
if fig.get_axes():
# Do stuff when the figure isn't empty.
fig = plt.figure()
if fig.get_axes():
# Do stuff when the figure isn't empty.