From: David H. <dav...@gm...> - 2007-09-26 18:28:23
|
Hi Dirk, If you haven't already done so, look at the numpy.ma module. It provides a masked array object that deals gracefully with missing values. To the best of my knowledge, most matplotlib functions understand masked arrays and deal with it accordingly, exception made of those requiring a full matrix (such as contour). Take a look at examples/image_masked.py. Also, in the Basemap toolkit, there is at least one example showing how to plot a masked array on a map. Cheers, David 2007/9/26, Dirk Zickermann <dir...@go...>: > > Dear matplotlib group, > > for the represenation of 2d measurement data I use the contourplot > function from matplotlib. Some points in this map are not measurabel, > therefore I get a non numerical value (nan) output. > > From this data I want to generate a map and a histogram plot. This works > fine, as long as I use regular matrix/array data structure without any > voids. > > My questions are: > (1) How can I make use of plotting data with NAN values as contour and > asigns such values eg as black points? > (2) How can I use the matplotlib hist() function with this data, that also > include such missing data points? > Maybe there is an easy workaround for this. > > Thanks a lot for your support, > Dirk > > (python2.51 /matplotlib-0.90.1, win32) > > my code: > ... > import matplotlib > ... > my2dData=[[1,2,3,4,5.0 ,NaN,7,8,9,10],[10,9,8,7,6,5,4,3,2,1]] > ... > figure(1) > imshow(my2dData) > pylab.show() > .. > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |