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

Skip to content

Commit e01a25f

Browse files
committed
mep12 on fonts_demo_kw.py
1 parent 7682bb1 commit e01a25f

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,81 @@
1-
#!/usr/bin/env python
21
"""
32
Same as fonts_demo using kwargs. If you prefer a more pythonic, OO
43
style of coding, see examples/fonts_demo.py.
54
65
"""
76
from matplotlib.font_manager import FontProperties
8-
from pylab import *
7+
import matplotlib.pyplot as plt
8+
import numpy as np
99

10-
subplot(111, axisbg='w')
10+
plt.subplot(111, axisbg='w')
1111
alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'}
1212

1313
# Show family options
1414

1515
families = ['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace']
1616

17-
t = text(-0.8, 0.9, 'family', size='large', **alignment)
17+
t = plt.text(-0.8, 0.9, 'family', size='large', **alignment)
1818

1919
yp = [0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2]
2020

2121
for k, family in enumerate(families):
22-
t = text(-0.8, yp[k], family, family=family, **alignment)
22+
t = plt.text(-0.8, yp[k], family, family=family, **alignment)
2323

2424
# Show style options
2525

2626
styles = ['normal', 'italic', 'oblique']
2727

28-
t = text(-0.4, 0.9, 'style', **alignment)
28+
t = plt.text(-0.4, 0.9, 'style', **alignment)
2929

3030
for k, style in enumerate(styles):
31-
t = text(-0.4, yp[k], style, family='sans-serif', style=style,
32-
**alignment)
31+
t = plt.text(-0.4, yp[k], style, family='sans-serif', style=style,
32+
**alignment)
3333

3434
# Show variant options
3535

3636
variants = ['normal', 'small-caps']
3737

38-
t = text(0.0, 0.9, 'variant', **alignment)
38+
t = plt.text(0.0, 0.9, 'variant', **alignment)
3939

4040
for k, variant in enumerate(variants):
41-
t = text(0.0, yp[k], variant, family='serif', variant=variant,
42-
**alignment)
41+
t = plt.text(0.0, yp[k], variant, family='serif', variant=variant,
42+
**alignment)
4343

4444
# Show weight options
4545

4646
weights = ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black']
4747

48-
t = text(0.4, 0.9, 'weight', **alignment)
48+
t = plt.text(0.4, 0.9, 'weight', **alignment)
4949

5050
for k, weight in enumerate(weights):
51-
t = text(0.4, yp[k], weight, weight=weight,
52-
**alignment)
51+
t = plt.text(0.4, yp[k], weight, weight=weight,
52+
**alignment)
5353

5454
# Show size options
5555

5656
sizes = ['xx-small', 'x-small', 'small', 'medium', 'large',
5757
'x-large', 'xx-large']
5858

59-
t = text(0.8, 0.9, 'size', **alignment)
59+
t = plt.text(0.8, 0.9, 'size', **alignment)
6060

6161
for k, size in enumerate(sizes):
62-
t = text(0.8, yp[k], size, size=size,
63-
**alignment)
62+
t = plt.text(0.8, yp[k], size, size=size,
63+
**alignment)
6464

6565
x = -0.4
6666
# Show bold italic
67-
t = text(x, 0.1, 'bold italic', style='italic',
68-
weight='bold', size='x-small',
69-
**alignment)
67+
t = plt.text(x, 0.1, 'bold italic', style='italic',
68+
weight='bold', size='x-small',
69+
**alignment)
7070

71-
t = text(x, 0.2, 'bold italic',
72-
style='italic', weight='bold', size='medium',
73-
**alignment)
71+
t = plt.text(x, 0.2, 'bold italic',
72+
style='italic', weight='bold', size='medium',
73+
**alignment)
7474

75-
t = text(x, 0.3, 'bold italic',
76-
style='italic', weight='bold', size='x-large',
77-
**alignment)
75+
t = plt.text(x, 0.3, 'bold italic',
76+
style='italic', weight='bold', size='x-large',
77+
**alignment)
7878

79-
axis([-1, 1, 0, 1])
79+
plt.axis([-1, 1, 0, 1])
8080

81-
show()
81+
plt.show()

0 commit comments

Comments
 (0)