Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 64ee574

Browse filesBrowse files
committed
Cleanup stix_fonts_demo example.
- The `s` variable conditionally defined was never used. - The `'--latex' in sys.argv` branch (which dates back to the origin of the example, a567601), likely never worked (\mathbb requires \usepackage{amsfonts}), so just kill it. - Saving the figure doesn't really help with the example and tends to clutter the source tree when running the example, so don't do it.
1 parent 2afeec7 commit 64ee574
Copy full SHA for 64ee574

File tree

Expand file treeCollapse file tree

1 file changed

+8
-39
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-39
lines changed

‎examples/text_labels_and_annotations/stix_fonts_demo.py

Copy file name to clipboardExpand all lines: examples/text_labels_and_annotations/stix_fonts_demo.py
+8-39Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@
55
66
"""
77

8-
import subprocess
9-
import sys
10-
import re
11-
import gc
128
import matplotlib.pyplot as plt
139
import numpy as np
1410

15-
stests = [
11+
tests = [
1612
r'$\mathcircled{123} \mathrm{\mathcircled{123}}'
1713
r' \mathbf{\mathcircled{123}}$',
1814
r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}}'
@@ -25,39 +21,12 @@
2521
r'$\mathfrak{Fraktur} \mathbf{\mathfrak{Fraktur}}$',
2622
r'$\mathscr{Script}$']
2723

28-
if sys.maxunicode > 0xffff:
29-
s = r'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
3024

25+
plt.figure(figsize=(8, (len(tests) * 1) + 2))
26+
plt.plot([0, 0], 'r')
27+
plt.axis([0, 3, -len(tests), 0])
28+
plt.yticks(-np.arange(len(tests)))
29+
for i, s in enumerate(tests):
30+
plt.text(0.1, -i, s, fontsize=32)
3131

32-
def doall():
33-
tests = stests
34-
35-
plt.figure(figsize=(8, (len(tests) * 1) + 2))
36-
plt.plot([0, 0], 'r')
37-
plt.grid(False)
38-
plt.axis([0, 3, -len(tests), 0])
39-
plt.yticks(np.arange(len(tests)) * -1)
40-
for i, s in enumerate(tests):
41-
plt.text(0.1, -i, s, fontsize=32)
42-
43-
plt.savefig('stix_fonts_example')
44-
plt.show()
45-
46-
47-
if '--latex' in sys.argv:
48-
fd = open("stix_fonts_examples.ltx", "w")
49-
fd.write("\\documentclass{article}\n")
50-
fd.write("\\begin{document}\n")
51-
fd.write("\\begin{enumerate}\n")
52-
53-
for i, s in enumerate(stests):
54-
s = re.sub(r"(?<!\\)\$", "$$", s)
55-
fd.write("\\item %s\n" % s)
56-
57-
fd.write("\\end{enumerate}\n")
58-
fd.write("\\end{document}\n")
59-
fd.close()
60-
61-
subprocess.call(["pdflatex", "stix_fonts_examples.ltx"])
62-
else:
63-
doall()
32+
plt.show()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.