@@ -1032,13 +1032,21 @@ def __init__(self, bbox,
10321032 filternorm = 1 ,
10331033 filterrad = 4.0 ,
10341034 resample = False ,
1035+ interp_at_native = True ,
10351036 ** kwargs
10361037 ):
10371038
10381039 """
10391040 cmap is a colors.Colormap instance
10401041 norm is a colors.Normalize instance to map luminance to 0-1
10411042
1043+ interp_at_native is a flag that determines whether or not interpolation should
1044+ still be applied when the image is displayed at its native resolution. A common
1045+ use case for this is when displaying an image for annotational purposes; it is
1046+ treated similarly to Photoshop (interpolation is only used when displaying the
1047+ image at non-native resolutions).
1048+
1049+
10421050 kwargs are an optional list of Artist keyword args
10431051
10441052 """
@@ -1054,6 +1062,7 @@ def __init__(self, bbox,
10541062 )
10551063
10561064 self .bbox = bbox
1065+ self .interp_at_native = interp_at_native
10571066
10581067 def get_window_extent (self , renderer = None ):
10591068 if renderer is None :
@@ -1120,13 +1129,16 @@ def make_image(self, renderer, magnification=1.0):
11201129 im .set_resample (self ._resample )
11211130
11221131 l , b , r , t = self .get_window_extent (renderer ).extents #bbox.extents
1123- widthDisplay = ( round (r ) + 0.5 ) - ( round (l ) - 0.5 )
1124- heightDisplay = ( round (t ) + 0.5 ) - ( round (b ) - 0.5 )
1132+ widthDisplay = round (r ) - round (l )
1133+ heightDisplay = round (t ) - round (b )
11251134 widthDisplay *= magnification
11261135 heightDisplay *= magnification
11271136
11281137 numrows , numcols = self ._A .shape [:2 ]
11291138
1139+ if not self .interp_at_native and widthDisplay == numcols and heightDisplay == numrows :
1140+ im .set_interpolation (0 )
1141+
11301142 # resize viewport to display
11311143 rx = widthDisplay / numcols
11321144 ry = heightDisplay / numrows
0 commit comments