From 80fd93525bc8a6c8e18eff5748b62124b6173828 Mon Sep 17 00:00:00 2001 From: Till Stensitzki Date: Mon, 21 Sep 2015 22:36:04 +0200 Subject: [PATCH 1/3] OffsetImage: use dpi_cor in get_extent Before the image was always drawn with 72 dpi. --- lib/matplotlib/offsetbox.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index a35403c9e369..a13e298f9b7c 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -1334,17 +1334,15 @@ def get_window_extent(self, renderer): return mtransforms.Bbox.from_bounds(ox - xd, oy - yd, w, h) def get_extent(self, renderer): - - # FIXME dpi_cor is never used if self._dpi_cor: # True, do correction dpi_cor = renderer.points_to_pixels(1.) else: dpi_cor = 1. - zoom = self.get_zoom() + zoom = self.get_zoom() data = self.get_data() ny, nx = data.shape[:2] - w, h = nx * zoom, ny * zoom + w, h = dpi_cor nx * zoom, dpi_cor * ny * zoom return w, h, 0, 0 From a171036c8eac8cc31b7f220319b4083c5132eea5 Mon Sep 17 00:00:00 2001 From: Till Stensitzki Date: Mon, 21 Sep 2015 22:39:46 +0200 Subject: [PATCH 2/3] Update offsetbox.py --- lib/matplotlib/offsetbox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index a13e298f9b7c..5727f891eb38 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -1342,7 +1342,7 @@ def get_extent(self, renderer): zoom = self.get_zoom() data = self.get_data() ny, nx = data.shape[:2] - w, h = dpi_cor nx * zoom, dpi_cor * ny * zoom + w, h = dpi_cor * nx * zoom, dpi_cor * ny * zoom return w, h, 0, 0 From 61df21970fb9f993d27d1fb4a1c5db05ef851336 Mon Sep 17 00:00:00 2001 From: Till Stensitzki Date: Mon, 21 Sep 2015 22:40:38 +0200 Subject: [PATCH 3/3] Update offsetbox.py --- lib/matplotlib/offsetbox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 5727f891eb38..28f08b322668 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -1339,7 +1339,7 @@ def get_extent(self, renderer): else: dpi_cor = 1. - zoom = self.get_zoom() + zoom = self.get_zoom() data = self.get_data() ny, nx = data.shape[:2] w, h = dpi_cor * nx * zoom, dpi_cor * ny * zoom