-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.ipy
32 lines (27 loc) · 1008 Bytes
/
plot.ipy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# https://github.com/nilsvu/texfig
# https://matplotlib.org/stable/gallery/userdemo/pgf_preamble_sgskip.html
##########################################################################
# Note: %matplotlib inline will throw errors if Latex commands requiring #
# packages loaded in the preamble are used! #
##########################################################################
import matplotlib as mpl
mpl.use('pgf')
from matplotlib import pyplot as plt
plt.rcParams.update({
"font.family": "sans-serif",
"text.usetex": False,
"pgf.rcfonts": False, # don't setup fonts from rc parameters
"pgf.preamble": "\n".join([
r"\usepackage{bm}",
])
})
# Extra settings
plt.rcParams.update({
'xtick.labelsize':'x-small',
'ytick.labelsize':'x-small'
})
# Common plot settings
TEXTWIDTH = 6.22404027778 # For wide figures
def save_plot(fig, dir, name):
fig.savefig(dir + '/' + name + '.pdf')
return fig.savefig(dir + '/' + name + '.pgf')