Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfd130c1

Browse files
committed
make sure only one zero label is returned
1 parentb8364c6 commitfd130c1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎lib/matplotlib/ticker.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,7 @@ class LogFormatterMathtext(LogFormatter):
10631063
"""
10641064
Format values for log axis using ``exponent = log_base(value)``.
10651065
"""
1066+
_min_zero_pos=None
10661067

10671068
def_non_decade_format(self,sign_string,base,fx,usetex):
10681069
'Return string for non-decade locations'
@@ -1076,16 +1077,21 @@ def __call__(self, x, pos=None):
10761077
"""
10771078
Return the format for tick value `x`.
10781079
1079-
The position `pos` is ignored.
1080+
The position `pos` is used for SymLogNorm for ensuring
1081+
only one zero entry is present.
10801082
"""
10811083
usetex=rcParams['text.usetex']
10821084
min_exp=rcParams['axes.formatter.min_exponent']
10831085

10841086
ifx==0:# Symlog
1085-
ifusetex:
1086-
return'$0$'
1087+
ifself._min_zero_posisNone:
1088+
self._min_zero_pos=pos
1089+
ifusetex:
1090+
return'$0$'
1091+
else:
1092+
return'$%s$'%_mathdefault('0')
10871093
else:
1088-
return'$%s$'%_mathdefault('0')
1094+
return''
10891095

10901096
sign_string='-'ifx<0else''
10911097
x=abs(x)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp