@@ -149,8 +149,9 @@ def paintEvent(self, e):
149
149
if QT_API == 'PySide' and six .PY3 :
150
150
ctypes .c_long .from_address (id (stringBuffer )).value = 1
151
151
152
+ origin = QtCore .QPoint (l , self .renderer .height - t )
152
153
pixmap = QtGui .QPixmap .fromImage (qImage )
153
- p .drawPixmap (QtCore . QPoint ( l , self .renderer . height - t ) , pixmap )
154
+ p .drawPixmap (origin / self ._dpi_ratio , pixmap )
154
155
155
156
# draw the zoom rectangle to the QPainter
156
157
if self ._drawRect is not None :
@@ -207,9 +208,11 @@ def blit(self, bbox=None):
207
208
bbox = self .figure .bbox
208
209
209
210
self .blitbox .append (bbox )
210
- l , b , w , h = bbox .bounds
211
+
212
+ # repaint uses logical pixels, not physical pixels like the renderer.
213
+ l , b , w , h = [pt / self ._dpi_ratio for pt in bbox .bounds ]
211
214
t = b + h
212
- self .repaint (l , self .renderer .height - t , w , h )
215
+ self .repaint (l , self .renderer .height / self . _dpi_ratio - t , w , h )
213
216
214
217
def print_figure (self , * args , ** kwargs ):
215
218
FigureCanvasAgg .print_figure (self , * args , ** kwargs )
0 commit comments