On a jupyterhub notebook (python 3.8.5) and using matplotlib (version 3.3.2) I am trying to create a simple plot. The cell content is as follows:
import matplotlib.pyplot as plt
def plot_something(time_array, dependent_var, label="label"):
plt.plot(time_array, dependent_var, label=label)
plt.xlabel('Time (ms)')
plt.ylabel(label)
plot_something([1,2,3], [4,5,6])
However, there is a strange scroll box drawn around the created image with a scrollbar at the right (i.e. you cannot see the whole image, you have to scroll!):
which does not happen for other matplotlib plots in the same notebook. The image shows the complete output cell (and you can see the upper part of the plot is missing. You need yo scroll up to see it).
How can I programatically avoid this strange box around the matplotlib plot?
P.S. I am not sure how to reproduce this problem. If I execute the code on top of the notebook it work fine, I get just the plot without that strange scroll box:
I also checked for differences in the actual displayed html code between these two cases. I did not any differences!