In Jupyter, if the last statement in a cell returns a matplotlib.Figure
, the figure is displayed.
One can perform a similar trick with custom classes by providing a _repr_png_
function in that class. However, matplotlib Figure
s do not provide this function. This makes me wonder. How does Jupyter "know" what to do with a matplotlib figure?