@@ -1,408 +1,408 | |||||
1 | import os |
|
1 | import os | |
2 | import numpy |
|
2 | import numpy | |
3 | import time, datetime |
|
3 | import time, datetime | |
4 | import mpldriver |
|
4 | import mpldriver | |
5 |
|
5 | |||
6 |
|
6 | |||
7 | class Figure: |
|
7 | class Figure: | |
8 |
|
8 | |||
9 | __driver = mpldriver |
|
9 | __driver = mpldriver | |
10 | fig = None |
|
10 | fig = None | |
11 |
|
11 | |||
12 | idfigure = None |
|
12 | idfigure = None | |
13 | wintitle = None |
|
13 | wintitle = None | |
14 | width = None |
|
14 | width = None | |
15 | height = None |
|
15 | height = None | |
16 | nplots = None |
|
16 | nplots = None | |
17 | timerange = None |
|
17 | timerange = None | |
18 |
|
18 | |||
19 | axesObjList = [] |
|
19 | axesObjList = [] | |
20 |
|
20 | |||
21 | WIDTH = None |
|
21 | WIDTH = None | |
22 | HEIGHT = None |
|
22 | HEIGHT = None | |
23 | PREFIX = 'fig' |
|
23 | PREFIX = 'fig' | |
24 |
|
24 | |||
25 | def __init__(self): |
|
25 | def __init__(self): | |
26 |
|
26 | |||
27 | raise ValueError, "This method is not implemented" |
|
27 | raise ValueError, "This method is not implemented" | |
28 |
|
28 | |||
29 | def __del__(self): |
|
29 | def __del__(self): | |
30 |
|
30 | |||
31 | self.__driver.closeFigure() |
|
31 | self.__driver.closeFigure() | |
32 |
|
32 | |||
33 | def getFilename(self, name, ext='.png'): |
|
33 | def getFilename(self, name, ext='.png'): | |
34 |
|
34 | |||
35 | path = '%s%03d' %(self.PREFIX, self.idfigure) |
|
35 | path = '%s%03d' %(self.PREFIX, self.idfigure) | |
36 | filename = '%s_%s%s' %(self.PREFIX, name, ext) |
|
36 | filename = '%s_%s%s' %(self.PREFIX, name, ext) | |
37 |
|
37 | |||
38 | return os.path.join(path, filename) |
|
38 | return os.path.join(path, filename) | |
39 |
|
39 | |||
40 | def getAxesObjList(self): |
|
40 | def getAxesObjList(self): | |
41 |
|
41 | |||
42 | return self.axesObjList |
|
42 | return self.axesObjList | |
43 |
|
43 | |||
44 | def getSubplots(self): |
|
44 | def getSubplots(self): | |
45 |
|
45 | |||
46 | raise ValueError, "Abstract method: This method should be defined" |
|
46 | raise ValueError, "Abstract method: This method should be defined" | |
47 |
|
47 | |||
48 | def getScreenDim(self, widthplot, heightplot): |
|
48 | def getScreenDim(self, widthplot, heightplot): | |
49 |
|
49 | |||
50 | nrow, ncol = self.getSubplots() |
|
50 | nrow, ncol = self.getSubplots() | |
51 |
|
51 | |||
52 | widthscreen = widthplot*ncol |
|
52 | widthscreen = widthplot*ncol | |
53 | heightscreen = heightplot*nrow |
|
53 | heightscreen = heightplot*nrow | |
54 |
|
54 | |||
55 | return widthscreen, heightscreen |
|
55 | return widthscreen, heightscreen | |
56 |
|
56 | |||
57 | def getTimeLim(self, x, xmin, xmax): |
|
57 | def getTimeLim(self, x, xmin, xmax): | |
58 |
|
58 | |||
59 | thisdatetime = datetime.datetime.utcfromtimestamp(numpy.min(x)) |
|
59 | thisdatetime = datetime.datetime.utcfromtimestamp(numpy.min(x)) | |
60 | thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0)) |
|
60 | thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0)) | |
61 |
|
61 | |||
62 | #################################################### |
|
62 | #################################################### | |
63 | #If the x is out of xrange |
|
63 | #If the x is out of xrange | |
64 | if xmax < (thisdatetime - thisdate).seconds/(60*60.): |
|
64 | if xmax < (thisdatetime - thisdate).seconds/(60*60.): | |
65 | xmin = None |
|
65 | xmin = None | |
66 | xmax = None |
|
66 | xmax = None | |
67 |
|
67 | |||
68 | if xmin == None: |
|
68 | if xmin == None: | |
69 | td = thisdatetime - thisdate |
|
69 | td = thisdatetime - thisdate | |
70 | xmin = td.seconds/(60*60.) |
|
70 | xmin = td.seconds/(60*60.) | |
71 |
|
71 | |||
72 | if xmax == None: |
|
72 | if xmax == None: | |
73 | xmax = xmin + self.timerange/(60*60.) |
|
73 | xmax = xmin + self.timerange/(60*60.) | |
74 |
|
74 | |||
75 |
mindt = thisdate + datetime.timedelta( |
|
75 | mindt = thisdate + datetime.timedelta(hours=xmin) - datetime.timedelta(seconds=time.timezone) | |
76 | tmin = time.mktime(mindt.timetuple()) |
|
76 | tmin = time.mktime(mindt.timetuple()) | |
77 |
|
77 | |||
78 |
maxdt = thisdate + datetime.timedelta( |
|
78 | maxdt = thisdate + datetime.timedelta(hours=xmax) - datetime.timedelta(seconds=time.timezone) | |
79 | tmax = time.mktime(maxdt.timetuple()) |
|
79 | tmax = time.mktime(maxdt.timetuple()) | |
80 |
|
80 | |||
81 | self.timerange = tmax - tmin |
|
81 | self.timerange = tmax - tmin | |
82 |
|
82 | |||
83 | return tmin, tmax |
|
83 | return tmin, tmax | |
84 |
|
84 | |||
85 | def init(self, idfigure, nplots, wintitle): |
|
85 | def init(self, idfigure, nplots, wintitle): | |
86 |
|
86 | |||
87 | raise ValueError, "This method has been replaced with createFigure" |
|
87 | raise ValueError, "This method has been replaced with createFigure" | |
88 |
|
88 | |||
89 | def createFigure(self, idfigure, wintitle, widthplot=None, heightplot=None): |
|
89 | def createFigure(self, idfigure, wintitle, widthplot=None, heightplot=None): | |
90 |
|
90 | |||
91 | """ |
|
91 | """ | |
92 | Crea la figura de acuerdo al driver y parametros seleccionados seleccionados. |
|
92 | Crea la figura de acuerdo al driver y parametros seleccionados seleccionados. | |
93 | Las dimensiones de la pantalla es calculada a partir de los atributos self.WIDTH |
|
93 | Las dimensiones de la pantalla es calculada a partir de los atributos self.WIDTH | |
94 | y self.HEIGHT y el numero de subplots (nrow, ncol) |
|
94 | y self.HEIGHT y el numero de subplots (nrow, ncol) | |
95 |
|
95 | |||
96 | Input: |
|
96 | Input: | |
97 | idfigure : Los parametros necesarios son |
|
97 | idfigure : Los parametros necesarios son | |
98 | wintitle : |
|
98 | wintitle : | |
99 |
|
99 | |||
100 | """ |
|
100 | """ | |
101 |
|
101 | |||
102 | if widthplot == None: |
|
102 | if widthplot == None: | |
103 | widthplot = self.WIDTH |
|
103 | widthplot = self.WIDTH | |
104 |
|
104 | |||
105 | if heightplot == None: |
|
105 | if heightplot == None: | |
106 | heightplot = self.HEIGHT |
|
106 | heightplot = self.HEIGHT | |
107 |
|
107 | |||
108 | self.idfigure = idfigure |
|
108 | self.idfigure = idfigure | |
109 |
|
109 | |||
110 | self.wintitle = wintitle |
|
110 | self.wintitle = wintitle | |
111 |
|
111 | |||
112 | self.widthscreen, self.heightscreen = self.getScreenDim(widthplot, heightplot) |
|
112 | self.widthscreen, self.heightscreen = self.getScreenDim(widthplot, heightplot) | |
113 |
|
113 | |||
114 | self.fig = self.__driver.createFigure(self.idfigure, |
|
114 | self.fig = self.__driver.createFigure(self.idfigure, | |
115 | self.wintitle, |
|
115 | self.wintitle, | |
116 | self.widthscreen, |
|
116 | self.widthscreen, | |
117 | self.heightscreen) |
|
117 | self.heightscreen) | |
118 |
|
118 | |||
119 | self.axesObjList = [] |
|
119 | self.axesObjList = [] | |
120 |
|
120 | |||
121 | def setDriver(self, driver=mpldriver): |
|
121 | def setDriver(self, driver=mpldriver): | |
122 |
|
122 | |||
123 | self.__driver = driver |
|
123 | self.__driver = driver | |
124 |
|
124 | |||
125 | def setTitle(self, title): |
|
125 | def setTitle(self, title): | |
126 |
|
126 | |||
127 | self.__driver.setTitle(self.fig, title) |
|
127 | self.__driver.setTitle(self.fig, title) | |
128 |
|
128 | |||
129 | def setWinTitle(self, title): |
|
129 | def setWinTitle(self, title): | |
130 |
|
130 | |||
131 | self.__driver.setWinTitle(self.fig, title=title) |
|
131 | self.__driver.setWinTitle(self.fig, title=title) | |
132 |
|
132 | |||
133 | def setTextFromAxes(self, text): |
|
133 | def setTextFromAxes(self, text): | |
134 |
|
134 | |||
135 | raise ValueError, "Este metodo ha sido reemplazaado con el metodo setText de la clase Axes" |
|
135 | raise ValueError, "Este metodo ha sido reemplazaado con el metodo setText de la clase Axes" | |
136 |
|
136 | |||
137 | def makeAxes(self, nrow, ncol, xpos, ypos, colspan, rowspan): |
|
137 | def makeAxes(self, nrow, ncol, xpos, ypos, colspan, rowspan): | |
138 |
|
138 | |||
139 | raise ValueError, "Este metodo ha sido reemplazaado con el metodo addAxes" |
|
139 | raise ValueError, "Este metodo ha sido reemplazaado con el metodo addAxes" | |
140 |
|
140 | |||
141 | def addAxes(self, *args): |
|
141 | def addAxes(self, *args): | |
142 | """ |
|
142 | """ | |
143 |
|
143 | |||
144 | Input: |
|
144 | Input: | |
145 | *args : Los parametros necesarios son |
|
145 | *args : Los parametros necesarios son | |
146 | nrow, ncol, xpos, ypos, colspan, rowspan |
|
146 | nrow, ncol, xpos, ypos, colspan, rowspan | |
147 | """ |
|
147 | """ | |
148 |
|
148 | |||
149 | axesObj = Axes(self.fig, *args) |
|
149 | axesObj = Axes(self.fig, *args) | |
150 | self.axesObjList.append(axesObj) |
|
150 | self.axesObjList.append(axesObj) | |
151 |
|
151 | |||
152 | def saveFigure(self, figpath, figfile, *args): |
|
152 | def saveFigure(self, figpath, figfile, *args): | |
153 |
|
153 | |||
154 | filename = os.path.join(figpath, figfile) |
|
154 | filename = os.path.join(figpath, figfile) | |
155 |
|
155 | |||
156 | fullpath = os.path.split(filename)[0] |
|
156 | fullpath = os.path.split(filename)[0] | |
157 |
|
157 | |||
158 | if not os.path.exists(fullpath): |
|
158 | if not os.path.exists(fullpath): | |
159 | os.mkdir(fullpath) |
|
159 | os.mkdir(fullpath) | |
160 |
|
160 | |||
161 | self.__driver.saveFigure(self.fig, filename, *args) |
|
161 | self.__driver.saveFigure(self.fig, filename, *args) | |
162 |
|
162 | |||
163 | def draw(self): |
|
163 | def draw(self): | |
164 |
|
164 | |||
165 | self.__driver.draw(self.fig) |
|
165 | self.__driver.draw(self.fig) | |
166 |
|
166 | |||
167 | def run(self): |
|
167 | def run(self): | |
168 |
|
168 | |||
169 | raise ValueError, "This method is not implemented" |
|
169 | raise ValueError, "This method is not implemented" | |
170 |
|
170 | |||
171 | axesList = property(getAxesObjList) |
|
171 | axesList = property(getAxesObjList) | |
172 |
|
172 | |||
173 |
|
173 | |||
174 | class Axes: |
|
174 | class Axes: | |
175 |
|
175 | |||
176 | __driver = mpldriver |
|
176 | __driver = mpldriver | |
177 | fig = None |
|
177 | fig = None | |
178 | ax = None |
|
178 | ax = None | |
179 | plot = None |
|
179 | plot = None | |
180 |
|
180 | |||
181 | __firsttime = None |
|
181 | __firsttime = None | |
182 |
|
182 | |||
183 | __showprofile = False |
|
183 | __showprofile = False | |
184 |
|
184 | |||
185 | xmin = None |
|
185 | xmin = None | |
186 | xmax = None |
|
186 | xmax = None | |
187 | ymin = None |
|
187 | ymin = None | |
188 | ymax = None |
|
188 | ymax = None | |
189 | zmin = None |
|
189 | zmin = None | |
190 | zmax = None |
|
190 | zmax = None | |
191 |
|
191 | |||
192 | def __init__(self, *args): |
|
192 | def __init__(self, *args): | |
193 |
|
193 | |||
194 | """ |
|
194 | """ | |
195 |
|
195 | |||
196 | Input: |
|
196 | Input: | |
197 | *args : Los parametros necesarios son |
|
197 | *args : Los parametros necesarios son | |
198 | fig, nrow, ncol, xpos, ypos, colspan, rowspan |
|
198 | fig, nrow, ncol, xpos, ypos, colspan, rowspan | |
199 | """ |
|
199 | """ | |
200 |
|
200 | |||
201 | ax = self.__driver.createAxes(*args) |
|
201 | ax = self.__driver.createAxes(*args) | |
202 | self.fig = args[0] |
|
202 | self.fig = args[0] | |
203 | self.ax = ax |
|
203 | self.ax = ax | |
204 | self.plot = None |
|
204 | self.plot = None | |
205 |
|
205 | |||
206 | self.__firsttime = True |
|
206 | self.__firsttime = True | |
207 | self.idlineList = [] |
|
207 | self.idlineList = [] | |
208 |
|
208 | |||
209 | def setText(self, text): |
|
209 | def setText(self, text): | |
210 |
|
210 | |||
211 | self.__driver.setAxesText(self.ax, text) |
|
211 | self.__driver.setAxesText(self.ax, text) | |
212 |
|
212 | |||
213 | def setXAxisAsTime(self): |
|
213 | def setXAxisAsTime(self): | |
214 | pass |
|
214 | pass | |
215 |
|
215 | |||
216 | def pline(self, x, y, |
|
216 | def pline(self, x, y, | |
217 | xmin=None, xmax=None, |
|
217 | xmin=None, xmax=None, | |
218 | ymin=None, ymax=None, |
|
218 | ymin=None, ymax=None, | |
219 | xlabel='', ylabel='', |
|
219 | xlabel='', ylabel='', | |
220 | title='', |
|
220 | title='', | |
221 | **kwargs): |
|
221 | **kwargs): | |
222 |
|
222 | |||
223 | """ |
|
223 | """ | |
224 |
|
224 | |||
225 | Input: |
|
225 | Input: | |
226 | x : |
|
226 | x : | |
227 | y : |
|
227 | y : | |
228 | xmin : |
|
228 | xmin : | |
229 | xmax : |
|
229 | xmax : | |
230 | ymin : |
|
230 | ymin : | |
231 | ymax : |
|
231 | ymax : | |
232 | xlabel : |
|
232 | xlabel : | |
233 | ylabel : |
|
233 | ylabel : | |
234 | title : |
|
234 | title : | |
235 | **kwargs : Los parametros aceptados son |
|
235 | **kwargs : Los parametros aceptados son | |
236 |
|
236 | |||
237 | ticksize |
|
237 | ticksize | |
238 | ytick_visible |
|
238 | ytick_visible | |
239 | """ |
|
239 | """ | |
240 |
|
240 | |||
241 | if self.__firsttime: |
|
241 | if self.__firsttime: | |
242 |
|
242 | |||
243 | if xmin == None: xmin = numpy.nanmin(x) |
|
243 | if xmin == None: xmin = numpy.nanmin(x) | |
244 | if xmax == None: xmax = numpy.nanmax(x) |
|
244 | if xmax == None: xmax = numpy.nanmax(x) | |
245 | if ymin == None: ymin = numpy.nanmin(y) |
|
245 | if ymin == None: ymin = numpy.nanmin(y) | |
246 | if ymax == None: ymax = numpy.nanmax(y) |
|
246 | if ymax == None: ymax = numpy.nanmax(y) | |
247 |
|
247 | |||
248 | self.plot = self.__driver.createPline(self.ax, x, y, |
|
248 | self.plot = self.__driver.createPline(self.ax, x, y, | |
249 | xmin, xmax, |
|
249 | xmin, xmax, | |
250 | ymin, ymax, |
|
250 | ymin, ymax, | |
251 | xlabel=xlabel, |
|
251 | xlabel=xlabel, | |
252 | ylabel=ylabel, |
|
252 | ylabel=ylabel, | |
253 | title=title, |
|
253 | title=title, | |
254 | **kwargs) |
|
254 | **kwargs) | |
255 |
|
255 | |||
256 | self.idlineList.append(0) |
|
256 | self.idlineList.append(0) | |
257 | self.__firsttime = False |
|
257 | self.__firsttime = False | |
258 | return |
|
258 | return | |
259 |
|
259 | |||
260 | self.__driver.pline(self.plot, x, y, xlabel=xlabel, |
|
260 | self.__driver.pline(self.plot, x, y, xlabel=xlabel, | |
261 | ylabel=ylabel, |
|
261 | ylabel=ylabel, | |
262 | title=title) |
|
262 | title=title) | |
263 |
|
263 | |||
264 | def addpline(self, x, y, idline, **kwargs): |
|
264 | def addpline(self, x, y, idline, **kwargs): | |
265 | lines = self.ax.lines |
|
265 | lines = self.ax.lines | |
266 |
|
266 | |||
267 | if idline in self.idlineList: |
|
267 | if idline in self.idlineList: | |
268 | self.__driver.set_linedata(self.ax, x, y, idline) |
|
268 | self.__driver.set_linedata(self.ax, x, y, idline) | |
269 |
|
269 | |||
270 | if idline not in(self.idlineList): |
|
270 | if idline not in(self.idlineList): | |
271 | self.__driver.addpline(self.ax, x, y, **kwargs) |
|
271 | self.__driver.addpline(self.ax, x, y, **kwargs) | |
272 | self.idlineList.append(idline) |
|
272 | self.idlineList.append(idline) | |
273 |
|
273 | |||
274 | return |
|
274 | return | |
275 |
|
275 | |||
276 | def pmultiline(self, x, y, |
|
276 | def pmultiline(self, x, y, | |
277 | xmin=None, xmax=None, |
|
277 | xmin=None, xmax=None, | |
278 | ymin=None, ymax=None, |
|
278 | ymin=None, ymax=None, | |
279 | xlabel='', ylabel='', |
|
279 | xlabel='', ylabel='', | |
280 | title='', |
|
280 | title='', | |
281 | **kwargs): |
|
281 | **kwargs): | |
282 |
|
282 | |||
283 | if self.__firsttime: |
|
283 | if self.__firsttime: | |
284 |
|
284 | |||
285 | if xmin == None: xmin = numpy.nanmin(x) |
|
285 | if xmin == None: xmin = numpy.nanmin(x) | |
286 | if xmax == None: xmax = numpy.nanmax(x) |
|
286 | if xmax == None: xmax = numpy.nanmax(x) | |
287 | if ymin == None: ymin = numpy.nanmin(y) |
|
287 | if ymin == None: ymin = numpy.nanmin(y) | |
288 | if ymax == None: ymax = numpy.nanmax(y) |
|
288 | if ymax == None: ymax = numpy.nanmax(y) | |
289 |
|
289 | |||
290 | self.plot = self.__driver.createPmultiline(self.ax, x, y, |
|
290 | self.plot = self.__driver.createPmultiline(self.ax, x, y, | |
291 | xmin, xmax, |
|
291 | xmin, xmax, | |
292 | ymin, ymax, |
|
292 | ymin, ymax, | |
293 | xlabel=xlabel, |
|
293 | xlabel=xlabel, | |
294 | ylabel=ylabel, |
|
294 | ylabel=ylabel, | |
295 | title=title, |
|
295 | title=title, | |
296 | **kwargs) |
|
296 | **kwargs) | |
297 | self.__firsttime = False |
|
297 | self.__firsttime = False | |
298 | return |
|
298 | return | |
299 |
|
299 | |||
300 | self.__driver.pmultiline(self.plot, x, y, xlabel=xlabel, |
|
300 | self.__driver.pmultiline(self.plot, x, y, xlabel=xlabel, | |
301 | ylabel=ylabel, |
|
301 | ylabel=ylabel, | |
302 | title=title) |
|
302 | title=title) | |
303 |
|
303 | |||
304 | def pmultilineyaxis(self, x, y, |
|
304 | def pmultilineyaxis(self, x, y, | |
305 | xmin=None, xmax=None, |
|
305 | xmin=None, xmax=None, | |
306 | ymin=None, ymax=None, |
|
306 | ymin=None, ymax=None, | |
307 | xlabel='', ylabel='', |
|
307 | xlabel='', ylabel='', | |
308 | title='', |
|
308 | title='', | |
309 | **kwargs): |
|
309 | **kwargs): | |
310 |
|
310 | |||
311 | if self.__firsttime: |
|
311 | if self.__firsttime: | |
312 |
|
312 | |||
313 | if xmin == None: xmin = numpy.nanmin(x) |
|
313 | if xmin == None: xmin = numpy.nanmin(x) | |
314 | if xmax == None: xmax = numpy.nanmax(x) |
|
314 | if xmax == None: xmax = numpy.nanmax(x) | |
315 | if ymin == None: ymin = numpy.nanmin(y) |
|
315 | if ymin == None: ymin = numpy.nanmin(y) | |
316 | if ymax == None: ymax = numpy.nanmax(y) |
|
316 | if ymax == None: ymax = numpy.nanmax(y) | |
317 |
|
317 | |||
318 | self.plot = self.__driver.createPmultilineYAxis(self.ax, x, y, |
|
318 | self.plot = self.__driver.createPmultilineYAxis(self.ax, x, y, | |
319 | xmin, xmax, |
|
319 | xmin, xmax, | |
320 | ymin, ymax, |
|
320 | ymin, ymax, | |
321 | xlabel=xlabel, |
|
321 | xlabel=xlabel, | |
322 | ylabel=ylabel, |
|
322 | ylabel=ylabel, | |
323 | title=title, |
|
323 | title=title, | |
324 | **kwargs) |
|
324 | **kwargs) | |
325 | if self.xmin == None: self.xmin = xmin |
|
325 | if self.xmin == None: self.xmin = xmin | |
326 | if self.xmax == None: self.xmax = xmax |
|
326 | if self.xmax == None: self.xmax = xmax | |
327 | if self.ymin == None: self.ymin = ymin |
|
327 | if self.ymin == None: self.ymin = ymin | |
328 | if self.ymax == None: self.ymax = ymax |
|
328 | if self.ymax == None: self.ymax = ymax | |
329 |
|
329 | |||
330 | self.__firsttime = False |
|
330 | self.__firsttime = False | |
331 | return |
|
331 | return | |
332 |
|
332 | |||
333 | self.__driver.pmultilineyaxis(self.plot, x, y, xlabel=xlabel, |
|
333 | self.__driver.pmultilineyaxis(self.plot, x, y, xlabel=xlabel, | |
334 | ylabel=ylabel, |
|
334 | ylabel=ylabel, | |
335 | title=title) |
|
335 | title=title) | |
336 |
|
336 | |||
337 | def pcolor(self, x, y, z, |
|
337 | def pcolor(self, x, y, z, | |
338 | xmin=None, xmax=None, |
|
338 | xmin=None, xmax=None, | |
339 | ymin=None, ymax=None, |
|
339 | ymin=None, ymax=None, | |
340 | zmin=None, zmax=None, |
|
340 | zmin=None, zmax=None, | |
341 | xlabel='', ylabel='', |
|
341 | xlabel='', ylabel='', | |
342 | title='', rti = False, colormap='jet', |
|
342 | title='', rti = False, colormap='jet', | |
343 | **kwargs): |
|
343 | **kwargs): | |
344 |
|
344 | |||
345 | """ |
|
345 | """ | |
346 | Input: |
|
346 | Input: | |
347 | x : |
|
347 | x : | |
348 | y : |
|
348 | y : | |
349 | x : |
|
349 | x : | |
350 | xmin : |
|
350 | xmin : | |
351 | xmax : |
|
351 | xmax : | |
352 | ymin : |
|
352 | ymin : | |
353 | ymax : |
|
353 | ymax : | |
354 | zmin : |
|
354 | zmin : | |
355 | zmax : |
|
355 | zmax : | |
356 | xlabel : |
|
356 | xlabel : | |
357 | ylabel : |
|
357 | ylabel : | |
358 | title : |
|
358 | title : | |
359 | **kwargs : Los parametros aceptados son |
|
359 | **kwargs : Los parametros aceptados son | |
360 | ticksize=9, |
|
360 | ticksize=9, | |
361 | cblabel='' |
|
361 | cblabel='' | |
362 | rti = True or False |
|
362 | rti = True or False | |
363 | """ |
|
363 | """ | |
364 |
|
364 | |||
365 | if self.__firsttime: |
|
365 | if self.__firsttime: | |
366 |
|
366 | |||
367 | if xmin == None: xmin = numpy.nanmin(x) |
|
367 | if xmin == None: xmin = numpy.nanmin(x) | |
368 | if xmax == None: xmax = numpy.nanmax(x) |
|
368 | if xmax == None: xmax = numpy.nanmax(x) | |
369 | if ymin == None: ymin = numpy.nanmin(y) |
|
369 | if ymin == None: ymin = numpy.nanmin(y) | |
370 | if ymax == None: ymax = numpy.nanmax(y) |
|
370 | if ymax == None: ymax = numpy.nanmax(y) | |
371 | if zmin == None: zmin = numpy.nanmin(z) |
|
371 | if zmin == None: zmin = numpy.nanmin(z) | |
372 | if zmax == None: zmax = numpy.nanmax(z) |
|
372 | if zmax == None: zmax = numpy.nanmax(z) | |
373 |
|
373 | |||
374 |
|
374 | |||
375 | self.plot = self.__driver.createPcolor(self.ax, x, y, z, |
|
375 | self.plot = self.__driver.createPcolor(self.ax, x, y, z, | |
376 | xmin, xmax, |
|
376 | xmin, xmax, | |
377 | ymin, ymax, |
|
377 | ymin, ymax, | |
378 | zmin, zmax, |
|
378 | zmin, zmax, | |
379 | xlabel=xlabel, |
|
379 | xlabel=xlabel, | |
380 | ylabel=ylabel, |
|
380 | ylabel=ylabel, | |
381 | title=title, |
|
381 | title=title, | |
382 | colormap=colormap, |
|
382 | colormap=colormap, | |
383 | **kwargs) |
|
383 | **kwargs) | |
384 |
|
384 | |||
385 | if self.xmin == None: self.xmin = xmin |
|
385 | if self.xmin == None: self.xmin = xmin | |
386 | if self.xmax == None: self.xmax = xmax |
|
386 | if self.xmax == None: self.xmax = xmax | |
387 | if self.ymin == None: self.ymin = ymin |
|
387 | if self.ymin == None: self.ymin = ymin | |
388 | if self.ymax == None: self.ymax = ymax |
|
388 | if self.ymax == None: self.ymax = ymax | |
389 | if self.zmin == None: self.zmin = zmin |
|
389 | if self.zmin == None: self.zmin = zmin | |
390 | if self.zmax == None: self.zmax = zmax |
|
390 | if self.zmax == None: self.zmax = zmax | |
391 |
|
391 | |||
392 | self.__firsttime = False |
|
392 | self.__firsttime = False | |
393 | return |
|
393 | return | |
394 |
|
394 | |||
395 | if rti: |
|
395 | if rti: | |
396 | self.__driver.addpcolor(self.ax, x, y, z, self.zmin, self.zmax, |
|
396 | self.__driver.addpcolor(self.ax, x, y, z, self.zmin, self.zmax, | |
397 | xlabel=xlabel, |
|
397 | xlabel=xlabel, | |
398 | ylabel=ylabel, |
|
398 | ylabel=ylabel, | |
399 | title=title, |
|
399 | title=title, | |
400 | colormap=colormap) |
|
400 | colormap=colormap) | |
401 | return |
|
401 | return | |
402 |
|
402 | |||
403 | self.__driver.pcolor(self.plot, z, |
|
403 | self.__driver.pcolor(self.plot, z, | |
404 | xlabel=xlabel, |
|
404 | xlabel=xlabel, | |
405 | ylabel=ylabel, |
|
405 | ylabel=ylabel, | |
406 | title=title) |
|
406 | title=title) | |
407 |
|
407 | |||
408 | No newline at end of file |
|
408 |
General Comments 0
You need to be logged in to leave comments.
Login now