How to use 'plt.figsize' in Python

Every line of 'plt.figsize' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
23def figsize(sizex, sizey):
24 """Set the default figure size to be [sizex, sizey].
25 This is just an easy to remember, convenience wrapper that sets::
26 matplotlib.rcParams['figure.figsize'] = [sizex, sizey]
27 """
28 import matplotlib
29 matplotlib.rcParams['figure.figsize'] = [sizex, sizey]
16def figsize(scale):
17 fig_width_pt = 488.13 # Get this from LaTeX using \the\textwidth
18 inches_per_pt = 1.0/72.27 # Convert pt to inch
19 golden_mean = (np.sqrt(5.0)-1.0)/1.8 # Aesthetic ratio (you could change this)
20 fig_width = fig_width_pt*inches_per_pt*scale # width in inches
21 fig_height = fig_width*golden_mean # height in inches
22 fig_size = [fig_width,fig_height]
23 return fig_size

Related snippets