From 159cb4ce5bcc3acf84f5e8ea616ac18b23a61847 Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Sat, 24 Jan 2026 05:32:02 +1000 Subject: [PATCH] Fix test_get_size_inches_rounding_and_reference_override --- ultraplot/axes/base.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ultraplot/axes/base.py b/ultraplot/axes/base.py index 0cda92037..ef9d59b43 100644 --- a/ultraplot/axes/base.py +++ b/ultraplot/axes/base.py @@ -1886,14 +1886,16 @@ def _get_size_inches(self): Return the width and height of the axes in inches. """ width, height = self.figure.get_size_inches() - bbox = self.get_position() + bbox = self.get_position(original=True) width = width * abs(bbox.width) height = height * abs(bbox.height) - dpi = getattr(self.figure, "dpi", None) + fig = self.figure + dpi = getattr(fig, "_original_dpi", None) + if dpi is None: + dpi = getattr(fig, "dpi", None) if dpi: width = round(width * dpi) / dpi height = round(height * dpi) / dpi - fig = self.figure if fig is not None and getattr(fig, "_refnum", None) == self.number: if getattr(fig, "_refwidth", None) is not None: width = fig._refwidth