| 750 | return self._format_maybe_minus_and_locale(fmt, value) |
| 751 | |
| 752 | def format_data(self, value): |
| 753 | # docstring inherited |
| 754 | e = math.floor(math.log10(abs(value))) |
| 755 | s = round(value / 10**e, 10) |
| 756 | significand = self._format_maybe_minus_and_locale( |
| 757 | "%d" if s % 1 == 0 else "%1.10g", s) |
| 758 | if e == 0: |
| 759 | return significand |
| 760 | exponent = self._format_maybe_minus_and_locale("%d", e) |
| 761 | if self._useMathText or self._usetex: |
| 762 | exponent = "10^{%s}" % exponent |
| 763 | return (exponent if s == 1 # reformat 1x10^y as 10^y |
| 764 | else rf"{significand} \times {exponent}") |
| 765 | else: |
| 766 | return f"{significand}e{exponent}" |
| 767 | |
| 768 | def get_offset(self): |
| 769 | """ |