Last active
November 19, 2019 18:34
-
-
Save thomasaarholt/9841ce2424bc40e3165142764e960150 to your computer and use it in GitHub Desktop.
Temporary workaround for traditional mpl figure behaviour with the ipympl widget backend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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