A community-maintained Python framework for creating mathematical animations.
Added include_sign flag to DecimalNumber
Grant Sanderson45c0e0ccb7e0
diff --git a/mobject/numbers.py b/mobject/numbers.pyindex 3fc2847f8..3a393968d 100644--- a/mobject/numbers.py+++ b/mobject/numbers.py@@ -13,6 +13,7 @@ class DecimalNumber(VMobject):"show_ellipsis": False,"unit": None, # Aligned to bottom unless it starts with "^""include_background_rectangle": False,+ "include_sign": False,}def __init__(self, number, **kwargs):@@ -30,6 +31,8 @@ class DecimalNumber(VMobject):)else:num_string = '%.*f' % (ndp, number)+ if self.include_sign and number >= 0:+ num_string = "+" + num_stringnegative_zero_string = "-%.*f" % (ndp, 0.)if num_string == negative_zero_string:num_string = num_string[1:]