Hi all, I use a array with dtype=object for mixing datetime and float values, like: ########################################## lionel[ETD-2006-01__PM2.5_DALTON]68>datas[0:5,] Sortie[68]: array(data = [[2006-01-05 00:00:00 33.0 1e-20] [2006-01-06 00:00:00 41.0 30.0] [2006-01-07 00:00:00 20.0 16.0] [2006-01-08 00:00:00 16.0 13.0] [2006-01-09 00:00:00 18.0 15.0]], mask = [[False False True] [False False False] [False False False] [False False False] [False False False]], fill_value=1e-20) ##########################################
but I get a error when I want to plot directly using plot_date(date2num(datas[:,0]),datas[:,1]): ########################################## --------------------------------------------------------------------------- exceptions.TypeError Traceback (most recent call last) /home/lionel/Etudes_Techniques/ETD-2006-01__PM2.5_DALTON/<ipython console> /usr/lib/python2.4/site-packages/matplotlib/pylab.py in plot_date(*args, **kwargs) 2038 hold(h) 2039 try: -> 2040 ret = gca().plot_date(*args, **kwargs) 2041 draw_if_interactive() 2042 except: /usr/lib/python2.4/site-packages/matplotlib/axes.py in plot_date(self, x, y, fmt, tz, xdate, ydate, **kwargs) 2159 if not self._hold: self.cla() 2160 -> 2161 ret = self.plot(x, y, fmt, **kwargs) 2162 2163 if xdate: /usr/lib/python2.4/site-packages/matplotlib/axes.py in plot(self, *args, **kwargs) 2121 if not self._hold: self.cla() 2122 lines = [] -> 2123 for line in self._get_lines(*args, **d): 2124 self.add_line(line) 2125 lines.append(line) /usr/lib/python2.4/site-packages/matplotlib/axes.py in _grab_next_args(self, *args, **kwargs) 308 if not is_string_like(remaining[2]): 309 raise ValueError, 'third arg must be a format string' --> 310 yield self._plot_3_args(remaining, **kwargs) 311 remaining=[] 312 continue /usr/lib/python2.4/site-packages/matplotlib/axes.py in _plot_3_args(self, tup3, **kwargs) 279 linestyle=linestyle, marker=marker, 280 markerfacecolor=color, --> 281 markeredgecolor=mec, 282 ) 283 self.set_lineprops(ret, **kwargs) /usr/lib/python2.4/site-packages/matplotlib/lines.py in __init__(self, xdata, ydata, linewidth, linestyle, color, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, antialiased, dash_capstyle, solid_capstyle, dash_joinstyle, solid_joinstyle, **kwargs) 204 self.verticalOffset = None 205 --> 206 self.set_data(xdata, ydata) 207 208 if not self._lineStyles.has_key(linestyle): /usr/lib/python2.4/site-packages/matplotlib/lines.py in set_data(self, *args) 280 281 self._x = asarray(x, Float) --> 282 self._y = asarray(y, Float) 283 284 self._logcache = None /usr/lib/python2.4/site-packages/numpy/oldnumeric/functions.py in asarray(a, typecode, dtype) 82 def asarray(a, typecode=None, dtype=None): 83 dtype = convtypecode2(typecode, dtype) ---> 84 return mu.array(a, dtype, copy=0) 85 86 def nonzero(a): TypeError: array cannot be safely cast to required type ########################################## but the line: plot_date(date2num(datas[:,0]), ma.masked_values(datas[:,1].tolist() ,1.e-20)) works perfectly. Do I do something wrong? thanks -- Lionel Roubeyrie - [EMAIL PROTECTED] LIMAIR http://www.limair.asso.fr ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users