🏥 🏭 Working on the COVID-19 response in Canada? Plotly & the Canadian government can help you and your organization. Learn more and get in touch.

Plots cut off in Jupyter (+ R, ggplot)

I seem to be encountering an intermittent bug with plots displaying incorrectly in Jupyter notebooks.

Sometimes my plots render fine:

But sometimes they have their height far too small, like so:

These screenshots were taken one right after the other (see the cell execution number), no other changes were made to the notebook, the code, the environment, etc.

It might be more common when my plots are complex, e.g. in the above example if I widen the filter to datetime < '2019-01-10', it seems to have the problem more often, but that might be my imagination.

I feel like this problem has been around for a long time, apologies if it’s a known problem and there’s a known solution.

Any tips?