Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Temporary workaround for traditional mpl figure behaviour with the ipympl widget backend
import matplotlib.pyplot as plt
def figure(figsize=None):
'Temporary workaround for traditional figure behaviour with the ipympl widget backend'
fig = plt.figure()
if figsize:
w, h = figsize
else:
w, h = plt.rcParams['figure.figsize']
fig.canvas.layout.height = str(h) + 'in'
fig.canvas.layout.width = str(w) + 'in'
return fig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.