Skip to content

Commit e2f8c89

Browse files
committed
mep12 on multiline.py
1 parent 76655e2 commit e2f8c89

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

examples/pylab_examples/multiline.py

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,40 @@
1-
#!/usr/bin/env python
2-
from pylab import *
3-
#from matplotlib.pyplot import *
4-
#from numpy import arange
5-
6-
if 1:
7-
figure(figsize=(7, 4))
8-
ax = subplot(121)
9-
ax.set_aspect(1)
10-
plot(arange(10))
11-
xlabel('this is a xlabel\n(with newlines!)')
12-
ylabel('this is vertical\ntest', multialignment='center')
13-
#ylabel('this is another!')
14-
text(2, 7, 'this is\nyet another test',
1+
import matplotlib.pyplot as plt
2+
import numpy as np
3+
4+
plt.figure(figsize=(7, 4))
5+
ax = plt.subplot(121)
6+
ax.set_aspect(1)
7+
plt.plot(np.arange(10))
8+
plt.xlabel('this is a xlabel\n(with newlines!)')
9+
plt.ylabel('this is vertical\ntest', multialignment='center')
10+
plt.text(2, 7, 'this is\nyet another test',
1511
rotation=45,
1612
horizontalalignment='center',
1713
verticalalignment='top',
1814
multialignment='center')
1915

20-
grid(True)
16+
plt.grid(True)
2117

22-
subplot(122)
18+
plt.subplot(122)
2319

24-
text(0.29, 0.7, "Mat\nTTp\n123", size=18,
20+
plt.text(0.29, 0.7, "Mat\nTTp\n123", size=18,
2521
va="baseline", ha="right", multialignment="left",
2622
bbox=dict(fc="none"))
2723

28-
text(0.34, 0.7, "Mag\nTTT\n123", size=18,
24+
plt.text(0.34, 0.7, "Mag\nTTT\n123", size=18,
2925
va="baseline", ha="left", multialignment="left",
3026
bbox=dict(fc="none"))
3127

32-
text(0.95, 0.7, "Mag\nTTT$^{A^A}$\n123", size=18,
28+
plt.text(0.95, 0.7, "Mag\nTTT$^{A^A}$\n123", size=18,
3329
va="baseline", ha="right", multialignment="left",
3430
bbox=dict(fc="none"))
3531

36-
xticks([0.2, 0.4, 0.6, 0.8, 1.],
32+
plt.xticks([0.2, 0.4, 0.6, 0.8, 1.],
3733
["Jan\n2009", "Feb\n2009", "Mar\n2009", "Apr\n2009", "May\n2009"])
3834

39-
axhline(0.7)
40-
title("test line spacing for multiline text")
35+
plt.axhline(0.7)
36+
plt.title("test line spacing for multiline text")
4137

42-
subplots_adjust(bottom=0.25, top=0.8)
43-
draw()
44-
show()
38+
plt.subplots_adjust(bottom=0.25, top=0.8)
39+
plt.draw()
40+
plt.show()

0 commit comments

Comments
 (0)