31
31
32
32
# map interpolation strings to module constants
33
33
_interpd_ = {
34
- 'antialiased ' : _image .NEAREST , # this will use nearest or Hanning...
34
+ 'auto ' : _image .NEAREST , # this will use nearest or Hanning...
35
35
'none' : _image .NEAREST , # fall back to nearest when not supported
36
36
'nearest' : _image .NEAREST ,
37
37
'bilinear' : _image .BILINEAR ,
50
50
'sinc' : _image .SINC ,
51
51
'lanczos' : _image .LANCZOS ,
52
52
'blackman' : _image .BLACKMAN ,
53
+ 'antialiased' : _image .NEAREST , # this will use nearest or Hanning...
53
54
}
54
55
55
56
interpolations_names = set (_interpd_ )
@@ -186,7 +187,7 @@ def _resample(
186
187
# compare the number of displayed pixels to the number of
187
188
# the data pixels.
188
189
interpolation = image_obj .get_interpolation ()
189
- if interpolation == 'antialiased' :
190
+ if interpolation in [ 'antialiased' , 'auto' ] :
190
191
# don't antialias if upsampling by an integer number or
191
192
# if zooming in more than a factor of 3
192
193
pos = np .array ([[0 , 0 ], [data .shape [1 ], data .shape [0 ]]])
@@ -425,7 +426,7 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
425
426
# if antialiased, this needs to change as window sizes
426
427
# change:
427
428
interpolation_stage = self ._interpolation_stage
428
- if interpolation_stage == 'antialiased' :
429
+ if interpolation_stage in [ 'antialiased' , 'auto' ] :
429
430
pos = np .array ([[0 , 0 ], [A .shape [1 ], A .shape [0 ]]])
430
431
disp = t .transform (pos )
431
432
dispx = np .abs (np .diff (disp [:, 0 ])) / A .shape [1 ]
@@ -758,9 +759,9 @@ def get_interpolation(self):
758
759
"""
759
760
Return the interpolation method the image uses when resizing.
760
761
761
- One of 'antialiased ', 'nearest ', 'bilinear ', 'bicubic ', 'spline16 ',
762
- 'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric ',
763
- 'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos',
762
+ One of 'auto ', 'antialiased ', 'nearest ', 'bilinear ', 'bicubic ',
763
+ 'spline16', ' spline36', 'hanning', 'hamming', 'hermite', 'kaiser',
764
+ 'quadric', ' catrom', 'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos',
764
765
or 'none'.
765
766
"""
766
767
return self ._interpolation
@@ -776,7 +777,7 @@ def set_interpolation(self, s):
776
777
777
778
Parameters
778
779
----------
779
- s : {'antialiased ', 'nearest', 'bilinear', 'bicubic', 'spline16', \
780
+ s : {'auto ', 'nearest', 'bilinear', 'bicubic', 'spline16', \
780
781
'spline36', 'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom', \
781
782
'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos', 'none'} or None
782
783
"""
@@ -799,14 +800,14 @@ def set_interpolation_stage(self, s):
799
800
800
801
Parameters
801
802
----------
802
- s : {'data', 'rgba', 'antialiased '} or None
803
+ s : {'data', 'rgba', 'auto '} or None
803
804
Whether to apply up/downsampling interpolation in data or RGBA
804
805
space. If None, use :rc:`image.interpolation_stage`.
805
- If 'antialiased ' we will check upsampling rate and if less
806
+ If 'auto ' we will check upsampling rate and if less
806
807
than 3 then use 'rgba', otherwise use 'data'.
807
808
"""
808
809
s = mpl ._val_or_rc (s , 'image.interpolation_stage' )
809
- _api .check_in_list (['data' , 'rgba' , 'antialiased ' ], s = s )
810
+ _api .check_in_list (['data' , 'rgba' , 'auto ' ], s = s )
810
811
self ._interpolation_stage = s
811
812
self .stale = True
812
813
@@ -886,7 +887,7 @@ class AxesImage(_ImageBase):
886
887
norm : str or `~matplotlib.colors.Normalize`
887
888
Maps luminance to 0-1.
888
889
interpolation : str, default: :rc:`image.interpolation`
889
- Supported values are 'none', 'antialiased ', 'nearest', 'bilinear',
890
+ Supported values are 'none', 'auto ', 'nearest', 'bilinear',
890
891
'bicubic', 'spline16', 'spline36', 'hanning', 'hamming', 'hermite',
891
892
'kaiser', 'quadric', 'catrom', 'gaussian', 'bessel', 'mitchell',
892
893
'sinc', 'lanczos', 'blackman'.
0 commit comments