Default figure size?

I am using plotly in Jupyter notebooks. I would like to be able to set a default figure size for all plots, instead of having to set it per plot.

I figured templates might do it, but unfortunately not. The code below defaults plots to the correct color scheme (of plotly_white), but the sizing does not stick.

What is the right way to set the default plot size?

import plotly.io as pio

localTemplate = pio.templates['plotly_white']
localTemplate.layout.width = 800   # <-- DOES NOT WORK
localTemplate.layout.height = 500  # <-- DOES NOT WORK
pio.templates['custom_template'] = localTemplate
pio.templates.default = 'custom_template'

You may need to disable autosize too.

pio.templates["custom_template"].layout.autosize = False

This was what worked for me using your code.