When matplotlib widget is loaded in python interactive mode, the plot will eventually cause Jupyter core to hangs. And it is not possible to submit next block of code or do anything until restarting ...
The first call to matshow() re-enables interactive mode after it has been disabled by matplotlib.interactive(False). In a Jupyter notebook, this has the result of a figure not intended for display ...