8000 ported wx to new backend · matplotlib/matplotlib@5506786 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5506786

Browse files
committed
ported wx to new backend
svn path=/trunk/matplotlib/; revision=119
1 parent 7f73fb0 commit 5506786

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

examples/anim.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env python2.3
2+
3+
import matplotlib.matlab
4+
import gtk
5+
import Numeric
6+
7+
fig = matplotlib.matlab.figure(1)
8+
ind = Numeric.arange(60)
9+
x_tmp=[]
10+
for i in range(100):
11+
x_tmp.append(Numeric.sin((ind+i)*Numeric.pi/15.0))
12+
13+
X=Numeric.array(x_tmp)
14+
lines = matplotlib.matlab.plot(X[:,0],'o')
15+
16+
manager = matplotlib.matlab.get_current_fig_manager()
17+
def updatefig(*args):
18+
updatefig.count += 1
19+
if updatefig.count>59: updatefig.count=0
20+
lines[0].set_data(ind,X[:,updatefig.count])
21+
manager.canvas.draw()
22+
return gtk.TRUE
23+
24+
updatefig.count=-1
25+
26+
gtk.timeout_add(25,updatefig)
27+
matplotlib.matlab.show()

examples/bar_stacked.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# a stacked bar plot with errorbars
2+
from matplotlib.matlab import *
3+
4+
N = 5
5+
menMeans = (20, 35, 30, 35, 27)
6+
womenMeans = (25, 32, 34, 20, 25)
7+
menStd = (2, 3, 4, 1, 2)
8+
womenStd = (3, 5, 2, 3, 3)
9+
ind = arange(N) # the x locations for the groups
10+
width = 0.35 # the width of the bars: can also be len(x) sequence
11+
12+
p1 = bar(ind, menMeans, width, color='r', yerr=womenStd)
13+
p2 = bar(ind, womenMeans, width, color='y',
14+
bottom=menMeans, yerr=menStd)
15+
16+
ylabel('Scores')
17+
title('Scores by group and gender')
18+
set(gca(), 'xticks', ind+(width/2))
19+
set(gca(), 'xticklabels', ('G1', 'G2', 'G3', 'G4', 'G5') )
20+
set(gca(), 'xlim', [-width,len(ind)])
21+
set(gca(), 'yticks', arange(0,81,10))
22+
legend( (p1[0], p2[0]), ('Men', 'Women') )
23+
24+
show()

0 commit comments

Comments
 (0)
0