Just catch the exception and ignore it:
try:
ax.set_ylim([y.min()-0.05, y.max()+0.05])
except ValueError: #raised if `y` is empty.
pass
by James Palmer
Just catch the exception and ignore it:
try:
ax.set_ylim([y.min()-0.05, y.max()+0.05])
except ValueError: #raised if `y` is empty.
pass