##// END OF EJS Templates
Daniel Valdez -
r279:198e40210b2c
parent child
Show More
@@ -1,373 +1,373
1 import numpy
1 import numpy
2 import datetime
2 import datetime
3 import sys
3 import sys
4 import matplotlib
4 import matplotlib
5
5
6 if 'linux' in sys.platform:
6 if 'linux' in sys.platform:
7 matplotlib.use("TKAgg")
7 matplotlib.use("TKAgg")
8
8
9 if 'darwin' in sys.platform:
9 if 'darwin' in sys.platform:
10 matplotlib.use("TKAgg")
10 matplotlib.use("TKAgg")
11
11
12 import matplotlib.pyplot
12 import matplotlib.pyplot
13
13
14 from mpl_toolkits.axes_grid1 import make_axes_locatable
14 from mpl_toolkits.axes_grid1 import make_axes_locatable
15 from matplotlib.ticker import *
15 from matplotlib.ticker import *
16
16
17 ###########################################
17 ###########################################
18 #Actualizacion de las funciones del driver
18 #Actualizacion de las funciones del driver
19 ###########################################
19 ###########################################
20
20
21 def createFigure(idfigure, wintitle, width, height, facecolor="w"):
21 def createFigure(idfigure, wintitle, width, height, facecolor="w"):
22
22
23 matplotlib.pyplot.ioff()
23 matplotlib.pyplot.ioff()
24 fig = matplotlib.pyplot.figure(num=idfigure, facecolor=facecolor)
24 fig = matplotlib.pyplot.figure(num=idfigure, facecolor=facecolor)
25 fig.canvas.manager.set_window_title(wintitle)
25 fig.canvas.manager.set_window_title(wintitle)
26 fig.canvas.manager.resize(width, height)
26 fig.canvas.manager.resize(width, height)
27 matplotlib.pyplot.ion()
27 matplotlib.pyplot.ion()
28 matplotlib.pyplot.show()
28 matplotlib.pyplot.show()
29
29
30 return fig
30 return fig
31
31
32 def closeFigure():
32 def closeFigure():
33
33
34 matplotlib.pyplot.ioff()
34 matplotlib.pyplot.ioff()
35 matplotlib.pyplot.show()
35 matplotlib.pyplot.show()
36
36
37 return
37 return
38
38
39 def saveFigure(fig, filename):
39 def saveFigure(fig, filename):
40
40
41 matplotlib.pyplot.ioff()
41 matplotlib.pyplot.ioff()
42 fig.savefig(filename)
42 fig.savefig(filename)
43 matplotlib.pyplot.ion()
43 matplotlib.pyplot.ion()
44
44
45 def setWinTitle(fig, title):
45 def setWinTitle(fig, title):
46
46
47 fig.canvas.manager.set_window_title(title)
47 fig.canvas.manager.set_window_title(title)
48
48
49 def setTitle(fig, title):
49 def setTitle(fig, title):
50
50
51 fig.suptitle(title)
51 fig.suptitle(title)
52
52
53 def createAxes(fig, nrow, ncol, xpos, ypos, colspan, rowspan):
53 def createAxes(fig, nrow, ncol, xpos, ypos, colspan, rowspan):
54
54
55 matplotlib.pyplot.ioff()
55 matplotlib.pyplot.ioff()
56 matplotlib.pyplot.figure(fig.number)
56 matplotlib.pyplot.figure(fig.number)
57 axes = matplotlib.pyplot.subplot2grid((nrow, ncol),
57 axes = matplotlib.pyplot.subplot2grid((nrow, ncol),
58 (xpos, ypos),
58 (xpos, ypos),
59 colspan=colspan,
59 colspan=colspan,
60 rowspan=rowspan)
60 rowspan=rowspan)
61
61
62 matplotlib.pyplot.ion()
62 matplotlib.pyplot.ion()
63 return axes
63 return axes
64
64
65 def setAxesText(ax, text):
65 def setAxesText(ax, text):
66
66
67 ax.annotate(text,
67 ax.annotate(text,
68 xy = (.1, .99),
68 xy = (.1, .99),
69 xycoords = 'figure fraction',
69 xycoords = 'figure fraction',
70 horizontalalignment = 'left',
70 horizontalalignment = 'left',
71 verticalalignment = 'top',
71 verticalalignment = 'top',
72 fontsize = 10)
72 fontsize = 10)
73
73
74 def printLabels(ax, xlabel, ylabel, title):
74 def printLabels(ax, xlabel, ylabel, title):
75
75
76 ax.set_xlabel(xlabel, size=11)
76 ax.set_xlabel(xlabel, size=11)
77 ax.set_ylabel(ylabel, size=11)
77 ax.set_ylabel(ylabel, size=11)
78 ax.set_title(title, size=12)
78 ax.set_title(title, size=12)
79
79
80 def createPline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='',
80 def createPline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='',
81 ticksize=9, xtick_visible=True, ytick_visible=True,
81 ticksize=9, xtick_visible=True, ytick_visible=True,
82 nxticks=4, nyticks=10,
82 nxticks=4, nyticks=10,
83 grid=None):
83 grid=None):
84
84
85 """
85 """
86
86
87 Input:
87 Input:
88 grid : None, 'both', 'x', 'y'
88 grid : None, 'both', 'x', 'y'
89 """
89 """
90
90
91 matplotlib.pyplot.ioff()
91 matplotlib.pyplot.ioff()
92
92
93 ax.set_xlim([xmin,xmax])
93 ax.set_xlim([xmin,xmax])
94 ax.set_ylim([ymin,ymax])
94 ax.set_ylim([ymin,ymax])
95
95
96 printLabels(ax, xlabel, ylabel, title)
96 printLabels(ax, xlabel, ylabel, title)
97
97
98 ######################################################
98 ######################################################
99 if (xmax-xmin)<=1:
99 if (xmax-xmin)<=1:
100 xtickspos = numpy.linspace(xmin,xmax,nxticks)
100 xtickspos = numpy.linspace(xmin,xmax,nxticks)
101 xtickspos = numpy.array([float("%.1f"%i) for i in xtickspos])
101 xtickspos = numpy.array([float("%.1f"%i) for i in xtickspos])
102 ax.set_xticks(xtickspos)
102 ax.set_xticks(xtickspos)
103 else:
103 else:
104 xtickspos = numpy.arange(nxticks)*int((xmax-xmin)/(nxticks)) + int(xmin)
104 xtickspos = numpy.arange(nxticks)*int((xmax-xmin)/(nxticks)) + int(xmin)
105 ax.set_xticks(xtickspos)
105 ax.set_xticks(xtickspos)
106
106
107 for tick in ax.get_xticklabels():
107 for tick in ax.get_xticklabels():
108 tick.set_visible(xtick_visible)
108 tick.set_visible(xtick_visible)
109
109
110 for tick in ax.xaxis.get_major_ticks():
110 for tick in ax.xaxis.get_major_ticks():
111 tick.label.set_fontsize(ticksize)
111 tick.label.set_fontsize(ticksize)
112
112
113 ######################################################
113 ######################################################
114 for tick in ax.get_yticklabels():
114 for tick in ax.get_yticklabels():
115 tick.set_visible(ytick_visible)
115 tick.set_visible(ytick_visible)
116
116
117 for tick in ax.yaxis.get_major_ticks():
117 for tick in ax.yaxis.get_major_ticks():
118 tick.label.set_fontsize(ticksize)
118 tick.label.set_fontsize(ticksize)
119
119
120 ax.plot(x, y)
120 ax.plot(x, y)
121 iplot = ax.lines[-1]
121 iplot = ax.lines[-1]
122
122
123 ######################################################
123 ######################################################
124 if '0.' in matplotlib.__version__[0:2]:
124 if '0.' in matplotlib.__version__[0:2]:
125 print "The matplotlib version has to be updated to 1.1 or newer"
125 print "The matplotlib version has to be updated to 1.1 or newer"
126 return iplot
126 return iplot
127
127
128 if '1.0.' in matplotlib.__version__[0:4]:
128 if '1.0.' in matplotlib.__version__[0:4]:
129 print "The matplotlib version has to be updated to 1.1 or newer"
129 print "The matplotlib version has to be updated to 1.1 or newer"
130 return iplot
130 return iplot
131
131
132 if grid != None:
132 if grid != None:
133 ax.grid(b=True, which='major', axis=grid)
133 ax.grid(b=True, which='major', axis=grid)
134
134
135 matplotlib.pyplot.tight_layout()
135 matplotlib.pyplot.tight_layout()
136
136
137 matplotlib.pyplot.ion()
137 matplotlib.pyplot.ion()
138
138
139 return iplot
139 return iplot
140
140
141 def set_linedata(ax, x, y, idline):
141 def set_linedata(ax, x, y, idline):
142
142
143 ax.lines[idline].set_data(x,y)
143 ax.lines[idline].set_data(x,y)
144
144
145 def pline(iplot, x, y, xlabel='', ylabel='', title=''):
145 def pline(iplot, x, y, xlabel='', ylabel='', title=''):
146
146
147 ax = iplot.get_axes()
147 ax = iplot.get_axes()
148
148
149 printLabels(ax, xlabel, ylabel, title)
149 printLabels(ax, xlabel, ylabel, title)
150
150
151 set_linedata(ax, x, y, idline=0)
151 set_linedata(ax, x, y, idline=0)
152
152
153 def addpline(ax, x, y, color, linestyle, lw):
153 def addpline(ax, x, y, color, linestyle, lw):
154
154
155 ax.plot(x,y,color=color,linestyle=linestyle,lw=lw)
155 ax.plot(x,y,color=color,linestyle=linestyle,lw=lw)
156
156
157
157
158 def createPcolor(ax, x, y, z, xmin, xmax, ymin, ymax, zmin, zmax,
158 def createPcolor(ax, x, y, z, xmin, xmax, ymin, ymax, zmin, zmax,
159 xlabel='', ylabel='', title='', ticksize = 9,
159 xlabel='', ylabel='', title='', ticksize = 9,
160 colormap='jet',cblabel='', cbsize="5%",
160 colormap='jet',cblabel='', cbsize="5%",
161 XAxisAsTime=False):
161 XAxisAsTime=False):
162
162
163 matplotlib.pyplot.ioff()
163 matplotlib.pyplot.ioff()
164
164
165 divider = make_axes_locatable(ax)
165 divider = make_axes_locatable(ax)
166 ax_cb = divider.new_horizontal(size=cbsize, pad=0.05)
166 ax_cb = divider.new_horizontal(size=cbsize, pad=0.05)
167 fig = ax.get_figure()
167 fig = ax.get_figure()
168 fig.add_axes(ax_cb)
168 fig.add_axes(ax_cb)
169
169
170 ax.set_xlim([xmin,xmax])
170 ax.set_xlim([xmin,xmax])
171 ax.set_ylim([ymin,ymax])
171 ax.set_ylim([ymin,ymax])
172
172
173 printLabels(ax, xlabel, ylabel, title)
173 printLabels(ax, xlabel, ylabel, title)
174
174
175 imesh = ax.pcolormesh(x,y,z.T, vmin=zmin, vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap))
175 imesh = ax.pcolormesh(x,y,z.T, vmin=zmin, vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap))
176 cb = matplotlib.pyplot.colorbar(imesh, cax=ax_cb)
176 cb = matplotlib.pyplot.colorbar(imesh, cax=ax_cb)
177 cb.set_label(cblabel)
177 cb.set_label(cblabel)
178
178
179 # for tl in ax_cb.get_yticklabels():
179 # for tl in ax_cb.get_yticklabels():
180 # tl.set_visible(True)
180 # tl.set_visible(True)
181
181
182 for tick in ax.yaxis.get_major_ticks():
182 for tick in ax.yaxis.get_major_ticks():
183 tick.label.set_fontsize(ticksize)
183 tick.label.set_fontsize(ticksize)
184
184
185 for tick in ax.xaxis.get_major_ticks():
185 for tick in ax.xaxis.get_major_ticks():
186 tick.label.set_fontsize(ticksize)
186 tick.label.set_fontsize(ticksize)
187
187
188 for tick in cb.ax.get_yticklabels():
188 for tick in cb.ax.get_yticklabels():
189 tick.set_fontsize(ticksize)
189 tick.set_fontsize(ticksize)
190
190
191 ax_cb.yaxis.tick_right()
191 ax_cb.yaxis.tick_right()
192
192
193 if '0.' in matplotlib.__version__[0:2]:
193 if '0.' in matplotlib.__version__[0:2]:
194 print "The matplotlib version has to be updated to 1.1 or newer"
194 print "The matplotlib version has to be updated to 1.1 or newer"
195 return imesh
195 return imesh
196
196
197 if '1.0.' in matplotlib.__version__[0:4]:
197 if '1.0.' in matplotlib.__version__[0:4]:
198 print "The matplotlib version has to be updated to 1.1 or newer"
198 print "The matplotlib version has to be updated to 1.1 or newer"
199 return imesh
199 return imesh
200
200
201 matplotlib.pyplot.tight_layout()
201 matplotlib.pyplot.tight_layout()
202
202
203 if XAxisAsTime:
203 if XAxisAsTime:
204
204
205 func = lambda x, pos: ('%s') %(datetime.datetime.utcfromtimestamp(x).strftime("%H:%M:%S"))
205 func = lambda x, pos: ('%s') %(datetime.datetime.utcfromtimestamp(x).strftime("%H:%M:%S"))
206 ax.xaxis.set_major_formatter(FuncFormatter(func))
206 ax.xaxis.set_major_formatter(FuncFormatter(func))
207 ax.xaxis.set_major_locator(LinearLocator(7))
207 ax.xaxis.set_major_locator(LinearLocator(7))
208
208
209 matplotlib.pyplot.ion()
209 matplotlib.pyplot.ion()
210 return imesh
210 return imesh
211
211
212 def pcolor(imesh, z, xlabel='', ylabel='', title=''):
212 def pcolor(imesh, z, xlabel='', ylabel='', title=''):
213
213
214 z = z.T
214 z = z.T
215
215
216 ax = imesh.get_axes()
216 ax = imesh.get_axes()
217
217
218 printLabels(ax, xlabel, ylabel, title)
218 printLabels(ax, xlabel, ylabel, title)
219
219
220 imesh.set_array(z.ravel())
220 imesh.set_array(z.ravel())
221
221
222 def addpcolor(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', colormap='jet'):
222 def addpcolor(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', colormap='jet'):
223
223
224 printLabels(ax, xlabel, ylabel, title)
224 printLabels(ax, xlabel, ylabel, title)
225
225
226 ax.collections.remove(ax.collections[0])
226 # ax.collections.remove(ax.collections[0])
227
227
228 ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap))
228 ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap))
229
229
230 def createPmultiline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None,
230 def createPmultiline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None,
231 ticksize=9, xtick_visible=True, ytick_visible=True,
231 ticksize=9, xtick_visible=True, ytick_visible=True,
232 nxticks=4, nyticks=10,
232 nxticks=4, nyticks=10,
233 grid=None):
233 grid=None):
234
234
235 """
235 """
236
236
237 Input:
237 Input:
238 grid : None, 'both', 'x', 'y'
238 grid : None, 'both', 'x', 'y'
239 """
239 """
240
240
241 matplotlib.pyplot.ioff()
241 matplotlib.pyplot.ioff()
242
242
243 lines = ax.plot(x.T, y)
243 lines = ax.plot(x.T, y)
244 leg = ax.legend(lines, legendlabels, loc='upper right')
244 leg = ax.legend(lines, legendlabels, loc='upper right')
245 leg.get_frame().set_alpha(0.5)
245 leg.get_frame().set_alpha(0.5)
246 ax.set_xlim([xmin,xmax])
246 ax.set_xlim([xmin,xmax])
247 ax.set_ylim([ymin,ymax])
247 ax.set_ylim([ymin,ymax])
248 printLabels(ax, xlabel, ylabel, title)
248 printLabels(ax, xlabel, ylabel, title)
249
249
250 xtickspos = numpy.arange(nxticks)*int((xmax-xmin)/(nxticks)) + int(xmin)
250 xtickspos = numpy.arange(nxticks)*int((xmax-xmin)/(nxticks)) + int(xmin)
251 ax.set_xticks(xtickspos)
251 ax.set_xticks(xtickspos)
252
252
253 for tick in ax.get_xticklabels():
253 for tick in ax.get_xticklabels():
254 tick.set_visible(xtick_visible)
254 tick.set_visible(xtick_visible)
255
255
256 for tick in ax.xaxis.get_major_ticks():
256 for tick in ax.xaxis.get_major_ticks():
257 tick.label.set_fontsize(ticksize)
257 tick.label.set_fontsize(ticksize)
258
258
259 for tick in ax.get_yticklabels():
259 for tick in ax.get_yticklabels():
260 tick.set_visible(ytick_visible)
260 tick.set_visible(ytick_visible)
261
261
262 for tick in ax.yaxis.get_major_ticks():
262 for tick in ax.yaxis.get_major_ticks():
263 tick.label.set_fontsize(ticksize)
263 tick.label.set_fontsize(ticksize)
264
264
265 iplot = ax.lines[-1]
265 iplot = ax.lines[-1]
266
266
267 if '0.' in matplotlib.__version__[0:2]:
267 if '0.' in matplotlib.__version__[0:2]:
268 print "The matplotlib version has to be updated to 1.1 or newer"
268 print "The matplotlib version has to be updated to 1.1 or newer"
269 return iplot
269 return iplot
270
270
271 if '1.0.' in matplotlib.__version__[0:4]:
271 if '1.0.' in matplotlib.__version__[0:4]:
272 print "The matplotlib version has to be updated to 1.1 or newer"
272 print "The matplotlib version has to be updated to 1.1 or newer"
273 return iplot
273 return iplot
274
274
275 if grid != None:
275 if grid != None:
276 ax.grid(b=True, which='major', axis=grid)
276 ax.grid(b=True, which='major', axis=grid)
277
277
278 matplotlib.pyplot.tight_layout()
278 matplotlib.pyplot.tight_layout()
279
279
280 matplotlib.pyplot.ion()
280 matplotlib.pyplot.ion()
281
281
282 return iplot
282 return iplot
283
283
284
284
285 def pmultiline(iplot, x, y, xlabel='', ylabel='', title=''):
285 def pmultiline(iplot, x, y, xlabel='', ylabel='', title=''):
286
286
287 ax = iplot.get_axes()
287 ax = iplot.get_axes()
288
288
289 printLabels(ax, xlabel, ylabel, title)
289 printLabels(ax, xlabel, ylabel, title)
290
290
291 for i in range(len(ax.lines)):
291 for i in range(len(ax.lines)):
292 line = ax.lines[i]
292 line = ax.lines[i]
293 line.set_data(x[i,:],y)
293 line.set_data(x[i,:],y)
294
294
295 def createPmultilineYAxis(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None,
295 def createPmultilineYAxis(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None,
296 ticksize=9, xtick_visible=True, ytick_visible=True,
296 ticksize=9, xtick_visible=True, ytick_visible=True,
297 nxticks=4, nyticks=10, marker='^', markersize=8, linestyle="solid",
297 nxticks=4, nyticks=10, marker='^', markersize=8, linestyle="solid",
298 grid=None, XAxisAsTime=False):
298 grid=None, XAxisAsTime=False):
299
299
300 """
300 """
301
301
302 Input:
302 Input:
303 grid : None, 'both', 'x', 'y'
303 grid : None, 'both', 'x', 'y'
304 """
304 """
305
305
306 matplotlib.pyplot.ioff()
306 matplotlib.pyplot.ioff()
307
307
308 lines = ax.plot(x, y.T, marker=marker,markersize=markersize,linestyle=linestyle)
308 lines = ax.plot(x, y.T, marker=marker,markersize=markersize,linestyle=linestyle)
309 leg = ax.legend(lines, legendlabels, loc='upper left', bbox_to_anchor=(1.01, 1.00), numpoints=1, handlelength=1.5, \
309 leg = ax.legend(lines, legendlabels, loc='upper left', bbox_to_anchor=(1.01, 1.00), numpoints=1, handlelength=1.5, \
310 handletextpad=0.5, borderpad=0.5, labelspacing=0.5, borderaxespad=0.)
310 handletextpad=0.5, borderpad=0.5, labelspacing=0.5, borderaxespad=0.)
311
311
312 for label in leg.get_texts(): label.set_fontsize(9)
312 for label in leg.get_texts(): label.set_fontsize(9)
313
313
314 ax.set_xlim([xmin,xmax])
314 ax.set_xlim([xmin,xmax])
315 ax.set_ylim([ymin,ymax])
315 ax.set_ylim([ymin,ymax])
316 printLabels(ax, xlabel, ylabel, title)
316 printLabels(ax, xlabel, ylabel, title)
317
317
318 # xtickspos = numpy.arange(nxticks)*int((xmax-xmin)/(nxticks)) + int(xmin)
318 # xtickspos = numpy.arange(nxticks)*int((xmax-xmin)/(nxticks)) + int(xmin)
319 # ax.set_xticks(xtickspos)
319 # ax.set_xticks(xtickspos)
320
320
321 for tick in ax.get_xticklabels():
321 for tick in ax.get_xticklabels():
322 tick.set_visible(xtick_visible)
322 tick.set_visible(xtick_visible)
323
323
324 for tick in ax.xaxis.get_major_ticks():
324 for tick in ax.xaxis.get_major_ticks():
325 tick.label.set_fontsize(ticksize)
325 tick.label.set_fontsize(ticksize)
326
326
327 for tick in ax.get_yticklabels():
327 for tick in ax.get_yticklabels():
328 tick.set_visible(ytick_visible)
328 tick.set_visible(ytick_visible)
329
329
330 for tick in ax.yaxis.get_major_ticks():
330 for tick in ax.yaxis.get_major_ticks():
331 tick.label.set_fontsize(ticksize)
331 tick.label.set_fontsize(ticksize)
332
332
333 iplot = ax.lines[-1]
333 iplot = ax.lines[-1]
334
334
335 if '0.' in matplotlib.__version__[0:2]:
335 if '0.' in matplotlib.__version__[0:2]:
336 print "The matplotlib version has to be updated to 1.1 or newer"
336 print "The matplotlib version has to be updated to 1.1 or newer"
337 return iplot
337 return iplot
338
338
339 if '1.0.' in matplotlib.__version__[0:4]:
339 if '1.0.' in matplotlib.__version__[0:4]:
340 print "The matplotlib version has to be updated to 1.1 or newer"
340 print "The matplotlib version has to be updated to 1.1 or newer"
341 return iplot
341 return iplot
342
342
343 if grid != None:
343 if grid != None:
344 ax.grid(b=True, which='major', axis=grid)
344 ax.grid(b=True, which='major', axis=grid)
345
345
346 matplotlib.pyplot.tight_layout()
346 matplotlib.pyplot.tight_layout()
347
347
348 if XAxisAsTime:
348 if XAxisAsTime:
349
349
350 func = lambda x, pos: ('%s') %(datetime.datetime.utcfromtimestamp(x).strftime("%H:%M:%S"))
350 func = lambda x, pos: ('%s') %(datetime.datetime.utcfromtimestamp(x).strftime("%H:%M:%S"))
351 ax.xaxis.set_major_formatter(FuncFormatter(func))
351 ax.xaxis.set_major_formatter(FuncFormatter(func))
352 ax.xaxis.set_major_locator(LinearLocator(7))
352 ax.xaxis.set_major_locator(LinearLocator(7))
353
353
354 matplotlib.pyplot.ion()
354 matplotlib.pyplot.ion()
355
355
356 return iplot
356 return iplot
357
357
358 def pmultilineyaxis(iplot, x, y, xlabel='', ylabel='', title=''):
358 def pmultilineyaxis(iplot, x, y, xlabel='', ylabel='', title=''):
359
359
360 ax = iplot.get_axes()
360 ax = iplot.get_axes()
361
361
362 printLabels(ax, xlabel, ylabel, title)
362 printLabels(ax, xlabel, ylabel, title)
363
363
364 for i in range(len(ax.lines)):
364 for i in range(len(ax.lines)):
365 line = ax.lines[i]
365 line = ax.lines[i]
366 line.set_data(x,y[i,:])
366 line.set_data(x,y[i,:])
367
367
368 def draw(fig):
368 def draw(fig):
369
369
370 if type(fig) == 'int':
370 if type(fig) == 'int':
371 raise ValueError, "This parameter should be of tpye matplotlib figure"
371 raise ValueError, "This parameter should be of tpye matplotlib figure"
372
372
373 fig.canvas.draw() No newline at end of file
373 fig.canvas.draw()
General Comments 0
You need to be logged in to leave comments. Login now