From eb2ce5a16567b3c2fcec4a82f0a533ee8edee690 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Thu, 7 Apr 2022 15:09:22 +0200 Subject: [PATCH] Improve paper size selection --- lib/matplotlib/backends/backend_ps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index 36fa002b0caf..decd4774042c 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -77,10 +77,10 @@ def __init__(self): def _get_papertype(w, h): - for key, (pw, ph) in sorted(papersize.items(), reverse=True): + for key, (pw, ph) in sorted(papersize.items(), key=lambda v: v[1]): if key.startswith('l'): continue - if w < pw and h < ph: + if w <= pw and h <= ph: return key return 'a0'