Skip to content

Commit 44141d6

Browse files
committed
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.
1 parent 18dfa31 commit 44141d6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/font_manager.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,9 @@ def set_size(self, size):
899899
size = float(size)
900900
except ValueError:
901901
if size is not None and size not in font_scalings:
902-
raise ValueError("size is invalid")
902+
raise ValueError(
903+
"Size is invalid. Valid font size are " + ", ".join(
904+
str(i) for i in font_scalings.keys()))
903905
self._size = size
904906

905907
def set_file(self, file):

0 commit comments

Comments
 (0)