From 44141d603a4cdcf80820efcc70108c8814f6e0cc Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Wed, 25 Feb 2015 11:02:04 +0100 Subject: [PATCH] ENH better error message for wrong fontsize When the fontsize provided is unknown to matplotlib, the error raised now contains the list of known fontsize. --- lib/matplotlib/font_manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index b281aba15d85..bf86649c7e73 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -899,7 +899,9 @@ def set_size(self, size): size = float(size) except ValueError: if size is not None and size not in font_scalings: - raise ValueError("size is invalid") + raise ValueError( + "Size is invalid. Valid font size are " + ", ".join( + str(i) for i in font_scalings.keys())) self._size = size def set_file(self, file):