%matplotlib widget
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
fig.canvas.layout.width = '7in'
fig.canvas.layout.height= '5in'
# if I hide the header here, I get a libpng error
# fig.canvas.header_visible = False
ax.plot([1,2,3], [4,5,3])
# hiding after rendering works
fig.canvas.header_visible = False
# hiding together with calls to toolbar options, work.
fig, ax = plt.subplots()
fig.canvas.layout.width = '7in'
fig.canvas.layout.height= '5in'
fig.canvas.toolbar_visible = False
fig.canvas.header_visible = False
ax.plot([1,2,3], [4,5,3])