-
Notifications
You must be signed in to change notification settings - Fork 906
/
Copy pathtip-font-family.py
54 lines (42 loc) · 1.61 KB
/
tip-font-family.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# ----------------------------------------------------------------------------
# Title: Scientific Visualisation - Python & Matplotlib
# Author: Nicolas P. Rougier
# License: BSD
# ----------------------------------------------------------------------------
import pathlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
ROOT_DIR = pathlib.Path(__file__).parent.parent
# Setup a plot such that only the bottom spine is shown
def setup(ax):
ax.spines['right'].set_color('none')
ax.spines['left'].set_color('none')
ax.yaxis.set_major_locator(ticker.NullLocator())
ax.spines['top'].set_color('none')
ax.spines['bottom'].set_position("center")
ax.xaxis.set_ticks_position('bottom')
ax.tick_params(which='major', width=1.00)
ax.tick_params(which='major', length=5)
ax.tick_params(which='minor', width=0.75)
ax.tick_params(which='minor', length=2.5)
ax.set_xlim(0, 5)
ax.set_ylim(0, 1)
ax.patch.set_alpha(0.0)
fig = plt.figure(figsize=(5, .5))
fig.patch.set_alpha(0.0)
n = 1
fontsize = 18
ax = plt.subplot(n, 1, 1)
ax.tick_params(axis='both', which='minor', labelsize=6)
setup(ax)
ax.xaxis.set_major_locator(ticker.MultipleLocator(1.0))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.2))
ax.xaxis.set_major_formatter(ticker.ScalarFormatter())
ax.xaxis.set_minor_formatter(ticker.ScalarFormatter())
ax.tick_params(axis='x', which='minor', rotation=0)
for tick in ax.get_xticklabels(which='both'):
tick.set_fontname("Roboto Condensed")
plt.tight_layout()
fig.savefig(ROOT_DIR / "figures/tip-font-family.pdf", transparent=True)
# plt.show()