On Wednesday 29 August 2007 10:02:14 John Morgan wrote: > I have some data, which I'd like to plot using matplotlib. Some of the data > has been flagged by some other software, and I have a boolean array, the > same shape as my original data which tells me which data has been flagged > .... > I'm sure I can get this approach to work but I thought I'd ask if there's > there a more elegant way to achieve the same aim.
two words: masked arrays. >>>import numpy >>>flagged = numpy.ma(initial_array, mask=boolean_array) >>>plot(flagged) That will take care of the unmasked data. For the masked values, just revert the mask. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users