Skip to content

Commit fa94cc3

Browse files
committed
Preserve sign (for symlog)
1 parent ed204cd commit fa94cc3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/ticker.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,7 @@ def __call__(self, x, pos=None):
10641064
if x == 0.0: # Symlog
10651065
return '0'
10661066

1067+
sign = np.sign(x)
10671068
x = abs(x)
10681069
b = self._base
10691070
# only label the decades
@@ -1079,7 +1080,7 @@ def __call__(self, x, pos=None):
10791080

10801081
vmin, vmax = self.axis.get_view_interval()
10811082
vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander=0.05)
1082-
s = self._num_to_string(x, vmin, vmax)
1083+
s = self._num_to_string(sign * x, vmin, vmax)
10831084
return self.fix_minus(s)
10841085

10851086
def format_data(self, value):

0 commit comments

Comments
 (0)