From: <ef...@us...> - 2008-02-04 06:50:03
|
Revision: 4936 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4936&view=rev Author: efiring Date: 2008-02-03 22:50:00 -0800 (Sun, 03 Feb 2008) Log Message: ----------- Add AxesImage.interpnames (based on old request by fr...@gm...) Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/image.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-02-03 21:38:20 UTC (rev 4935) +++ trunk/matplotlib/CHANGELOG 2008-02-04 06:50:00 UTC (rev 4936) @@ -1,3 +1,6 @@ +2008-02-03 Expose interpnames, a list of valid interpolation + methods, as an AxesImage class attribute. - EF + 2008-02-03 Added BoundaryNorm, with examples in colorbar_only.py and image_masked.py. - EF Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2008-02-03 21:38:20 UTC (rev 4935) +++ trunk/matplotlib/lib/matplotlib/image.py 2008-02-04 06:50:00 UTC (rev 4936) @@ -24,7 +24,32 @@ class AxesImage(martist.Artist, cm.ScalarMappable): zorder = 1 + # map interpolation strings to module constants + _interpd = { + 'nearest' : _image.NEAREST, + 'bilinear' : _image.BILINEAR, + 'bicubic' : _image.BICUBIC, + 'spline16' : _image.SPLINE16, + 'spline36' : _image.SPLINE36, + 'hanning' : _image.HANNING, + 'hamming' : _image.HAMMING, + 'hermite' : _image.HERMITE, + 'kaiser' : _image.KAISER, + 'quadric' : _image.QUADRIC, + 'catrom' : _image.CATROM, + 'gaussian' : _image.GAUSSIAN, + 'bessel' : _image.BESSEL, + 'mitchell' : _image.MITCHELL, + 'sinc' : _image.SINC, + 'lanczos' : _image.LANCZOS, + 'blackman' : _image.BLACKMAN, + } + # reverse interp dict + _interpdr = dict([ (v,k) for k,v in _interpd.items()]) + + interpnames = _interpd.keys() + def __init__(self, ax, cmap = None, norm = None, @@ -59,30 +84,7 @@ self.set_filterrad(filterrad) - # map interpolation strings to module constants - self._interpd = { - 'nearest' : _image.NEAREST, - 'bilinear' : _image.BILINEAR, - 'bicubic' : _image.BICUBIC, - 'spline16' : _image.SPLINE16, - 'spline36' : _image.SPLINE36, - 'hanning' : _image.HANNING, - 'hamming' : _image.HAMMING, - 'hermite' : _image.HERMITE, - 'kaiser' : _image.KAISER, - 'quadric' : _image.QUADRIC, - 'catrom' : _image.CATROM, - 'gaussian' : _image.GAUSSIAN, - 'bessel' : _image.BESSEL, - 'mitchell' : _image.MITCHELL, - 'sinc' : _image.SINC, - 'lanczos' : _image.LANCZOS, - 'blackman' : _image.BLACKMAN, - } - # reverse interp dict - self._interpdr = dict([ (v,k) for k,v in self._interpd.items()]) - self.set_interpolation(interpolation) self.axes = ax This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |