forked from SGDE2020/embedding_stability
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscale_to_latex.py
21 lines (19 loc) · 870 Bytes
/
scale_to_latex.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def get_figsize(columnwidth, wf=0.5, hf=(5.**0.5-1.0)/2.0, ):
""" Credit: https://stackoverflow.com/a/31527287
Parameters:
- wf [float]: width fraction in columnwidth units
- hf [float]: height fraction in columnwidth units.
Set by default to golden ratio.
- columnwidth [float]: width of the column in latex. Get this from LaTeX
using \showthe\columnwidth
Returns: [fig_width,fig_height]: that should be given to matplotlib
"""
fig_width_pt = columnwidth*wf
inches_per_pt = 1.0/72.27 # Convert pt to inch
fig_width = fig_width_pt*inches_per_pt # width in inches
fig_height = fig_width*hf # height in inches
return [fig_width, fig_height, 1/hf]
def get_textwidth():
return 506.295 # pt
def get_columnwidth():
return 241.14749 # pt