Skip to content

Commit dc63626

Browse files
committed
Make pixel index correspond to center of pixel in viewer
1 parent 24cb2cf commit dc63626

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

astrowidgets/bqplot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,11 @@ def set_data(self, image_data, reset_view=True):
149149

150150
# Set the image data and map it to the bqplot figure so that
151151
# cursor location corresponds to the underlying array index.
152+
# The offset follows the convention that the index corresponds
153+
# to the center of the pixel.
152154
self._image.image = image_data
153-
self._image.x = [0, self._image_shape[1]]
154-
self._image.y = [0, self._image_shape[0]]
155+
self._image.x = [-0.5, self._image_shape[1] - 0.5]
156+
self._image.y = [-0.5, self._image_shape[0] - 0.5]
155157

156158
@property
157159
def center(self):

0 commit comments

Comments
 (0)