(self, x, pos=None)
| 1074 | return self._pprint_val(x, vmax - vmin) if 1 <= x <= 10000 else f"{x:1.0e}" |
| 1075 | |
| 1076 | def __call__(self, x, pos=None): |
| 1077 | # docstring inherited |
| 1078 | if x == 0.0: # Symlog |
| 1079 | return '0' |
| 1080 | |
| 1081 | x = abs(x) |
| 1082 | b = self._base |
| 1083 | # only label the decades |
| 1084 | fx = math.log(x) / math.log(b) |
| 1085 | is_x_decade = _is_close_to_int(fx) |
| 1086 | exponent = round(fx) if is_x_decade else np.floor(fx) |
| 1087 | coeff = round(b ** (fx - exponent)) |
| 1088 | |
| 1089 | if self.labelOnlyBase and not is_x_decade: |
| 1090 | return '' |
| 1091 | if self._sublabels is not None and coeff not in self._sublabels: |
| 1092 | return '' |
| 1093 | |
| 1094 | vmin, vmax = self.axis.get_view_interval() |
| 1095 | vmin, vmax = mtransforms._nonsingular(vmin, vmax, expander=0.05) |
| 1096 | s = self._num_to_string(x, vmin, vmax) |
| 1097 | return self.fix_minus(s) |
| 1098 | |
| 1099 | def format_data(self, value): |
| 1100 | with cbook._setattr_cm(self, labelOnlyBase=False): |
no test coverage detected