@@ -2488,7 +2488,7 @@ def __init__(self,
24882488 The figure dimensions. This can be
24892489
24902490 - a tuple ``(width, height, unit)``, where *unit* is one of "in" (inch),
2491- "cm" (centimenter), "px" (pixel).
2491+ "cm" (centimenter), "mm" (millimeter), " px" (pixel).
24922492 - a tuple ``(width, height)``, which is interpreted in inches, i.e. as
24932493 ``(width, height, "in")``.
24942494
@@ -3761,7 +3761,7 @@ def _parse_figsize(figsize, dpi):
37613761 This can be
37623762
37633763 - a tuple ``(width, height, unit)``, where *unit* is one of "in" (inch),
3764- "cm" (centimenter ), "px" (pixel).
3764+ "cm" (centimeter), "mm" (millimeter ), "px" (pixel).
37653765 - a tuple ``(width, height)``, which is interpreted in inches, i.e. as
37663766 ``(width, height, "in")``.
37673767
@@ -3780,6 +3780,11 @@ def _parse_figsize(figsize, dpi):
37803780 x /= 2.54
37813781 if y is not None :
37823782 y /= 2.54
3783+ elif unit == 'mm' :
3784+ if x is not None :
3785+ x /= 25.4
3786+ if y is not None :
3787+ y /= 25.4
37833788 elif unit == 'px' :
37843789 if x is not None :
37853790 x /= dpi
@@ -3788,7 +3793,7 @@ def _parse_figsize(figsize, dpi):
37883793 else :
37893794 raise ValueError (
37903795 f"Invalid unit { unit !r} in 'figsize'; "
3791- "supported units are 'in', 'cm', 'px'"
3796+ "supported units are 'in', 'cm', 'mm', ' px'"
37923797 )
37933798 else :
37943799 raise ValueError (
0 commit comments