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'