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

Skip to content

Commit 623f43e

Browse files
committed
updated legend unit
svn path=/trunk/matplotlib/; revision=3172
1 parent 56ef1a8 commit 623f43e

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

unit/legend_unit.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
from pylab import figure, show, nx
22

3+
Ntests = 3
4+
t = nx.arange(0.0, 1.0, 0.05)
5+
s = nx.sin(2*nx.pi*t)
6+
37
# scatter creates a RegPolyCollection
48
fig = figure()
5-
ax = fig.add_subplot(111)
9+
ax = fig.add_subplot(Ntests, 1, 1)
610
N = 100
711
x, y = 0.9*nx.mlab.rand(2,N)
812
area = nx.pi*(10 * nx.mlab.rand(N))**2 # 0 to 10 point radiuses
913
ax.scatter(x,y,s=area, marker='^', c='r', label='scatter')
1014
ax.legend()
11-
fig.savefig('legend_unit_polycoll')
1215

1316
# vlines creates a LineCollection
14-
fig = figure()
15-
ax = fig.add_subplot(111)
16-
t = nx.arange(0.0, 1.0, 0.05)
17+
ax = fig.add_subplot(Ntests, 1, 2)
1718
ax.vlines(t, [0], nx.sin(2*nx.pi*t), label='vlines')
1819
ax.legend()
19-
fig.savefig('legend_unit_linecoll')
20+
21+
# vlines creates a LineCollection
22+
ax = fig.add_subplot(Ntests, 1, 3)
23+
ax.plot(t, s, 'b-', lw=2, label='a line')
24+
ax.legend()
25+
26+
fig.savefig('legend_unit')
2027
show()

0 commit comments

Comments
 (0)