From: Eric F. <ef...@ha...> - 2005-02-22 00:01:05
|
Stephen, >> Are you suggesting something like this? Let each plotting function >> have a new kwarg, perhaps called "validmask", with the same dimensions >> as the dependent variable to be plotted, and with nonzero where the >> variable is valid and 0 where it is missing. > > > More or less, except that the mask is an attribute (?) of a MaskedArray > object. I for one would be in favor of this capability. I agree that this is an alternative, but I am not sure that it is better than what I described. It requires all the machinery of the ma/MA module, which looks cumbersome to me. What does it gain? max and min will do the right thing on the masked array input, so one would not have to duplicate this inside matplotlib. It is not hard to duplicate, however. How much more ma/MA functionality would actually be useful? When it was originally developed, the MaskedArray may have been a good way to get past Numeric's lack of nan-handling. In the long run, however, it seems to me that Python needs a numeric module with good nan-handling (as in Matlab and Octave), and that this will render the Masked Array obsolete. If so, then specifying a mask as a kwarg in matplotlib, and not using MA internally, may be simpler, more robust, and more flexible. The user would still be free to use MA/ma externally, if desired. A variation would be to support MA/ma in matplotlib only to the extent of checking for a MaskedArray input, and if it is present, breaking it apart and using the mask as if it had come via the kwarg. One could use either the kwarg or a Masked Array. Eric |