Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8091ba4

Browse files
committed
Merge pull request #4683 from ericmjl/mep12-stix_fonts_demo.py
MEP12 on stix_fonts_demo.py
2 parents 6cd1ddd + 74268f5 commit 8091ba4

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

examples/pylab_examples/stix_fonts_demo.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
#!/usr/bin/env python
2-
31
from __future__ import unicode_literals
42

53
import os
64
import sys
75
import re
8-
96
import gc
7+
import matplotlib.pyplot as plt
8+
import numpy as np
109

1110
stests = [
12-
r'$\mathcircled{123} \mathrm{\mathcircled{123}} \mathbf{\mathcircled{123}}$',
13-
r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}} \mathbf{\mathsf{Sans \Omega}}$',
11+
r'$\mathcircled{123} \mathrm{\mathcircled{123}} \
12+
\mathbf{\mathcircled{123}}$',
13+
r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}} \
14+
\mathbf{\mathsf{Sans \Omega}}$',
1415
r'$\mathtt{Monospace}$',
1516
r'$\mathcal{CALLIGRAPHIC}$',
1617
r'$\mathbb{Blackboard \pi}$',
@@ -22,24 +23,21 @@
2223
if sys.maxunicode > 0xffff:
2324
s = r'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
2425

25-
from pylab import *
26-
2726

2827
def doall():
2928
tests = stests
3029

31-
figure(figsize=(8, (len(tests) * 1) + 2))
32-
plot([0, 0], 'r')
33-
grid(False)
34-
axis([0, 3, -len(tests), 0])
35-
yticks(arange(len(tests)) * -1)
30+
plt.figure(figsize=(8, (len(tests) * 1) + 2))
31+
plt.plot([0, 0], 'r')
32+
plt.grid(False)
33+
plt.axis([0, 3, -len(tests), 0])
34+
plt.yticks(np.arange(len(tests)) * -1)
3635
for i, s in enumerate(tests):
37-
#print(i, s.encode("ascii", "backslashreplace"))
38-
text(0.1, -i, s, fontsize=32)
36+
plt.text(0.1, -i, s, fontsize=32)
37+
38+
plt.savefig('stix_fonts_example')
39+
plt.show()
3940

40-
savefig('stix_fonts_example')
41-
#close('all')
42-
show()
4341

4442
if '--latex' in sys.argv:
4543
fd = open("stix_fonts_examples.ltx", "w")

0 commit comments

Comments
 (0)