Black Lives Matter. Please consider donating to Black Girls Code today.

How can I change the background color of a heatmap plot?

I’ve a heatmap plot of data which contains a lot of NaN values. I’m using colorscale='Virdis' which results in bad contrast of the heatmap plot. How can I change the background color of the heatmap plot to e.g. black?

Found it: fig['layout'].update(plot_bgcolor='black').