99from artist import Artist
1010from axis import XAxis , YAxis
1111from cbook import iterable , is_string_like , flatten , enumerate , True , False ,\
12- allequal , dict_delall
12+ allequal , dict_delall , strip_math
1313from collections import RegularPolyCollection , PolyCollection
1414from colors import colorConverter , normalize , Colormap , LinearSegmentedColormap
1515import cm
@@ -496,7 +496,15 @@ def format_xdata(self, x):
496496 try : return self .fmt_xdata (x )
497497 except TypeError :
498498 func = self .xaxis .get_major_formatter ()
499- return func (x )
499+ # log formatters label only the decades which is not what
500+ # we want for coord formatting. hackish, yes
501+ if isinstance (func , LogFormatter ) and func .labelOnlyBase :
502+ func .labelOnlyBase = False
503+ val = strip_math (func (x ))
504+ func .labelOnlyBase = True
505+ else :
506+ val = func (x )
507+ return val
500508
501509 def format_ydata (self , y ):
502510 """\
@@ -507,7 +515,15 @@ def format_ydata(self, y):
507515 try : return self .fmt_ydata (y )
508516 except TypeError :
509517 func = self .yaxis .get_major_formatter ()
510- return func (y )
518+ # log formatters label only the decades which is not what
519+ # we want for coord formatting. hackish, yes
520+ if isinstance (func , LogFormatter ) and func .labelOnlyBase :
521+ func .labelOnlyBase = False
522+ val = strip_math (func (y ))
523+ func .labelOnlyBase = True
524+ else :
525+ val = func (y )
526+ return val
511527
512528 def format_coord (self , x , y ):
513529 'return a format string formatting the x, y coord'
0 commit comments