Unused matplotlibrc parameter

Hello,

I think there is an unused parameter in matplotlibrc, the text.markup which defaults to 'plain'. text.markup is not found in rcsetup.py.

Similarly, there is a keyword to ScalarFormatter, useMathText, that is always set to its default, False, in ticker.py; no other function accesses or uses that keyword. It seems that could be eliminated without ill-effect.

I came across this while looking for a way to have the tick formatter include a multiplication sign when writing very large numbers, instead of using engineering notation such as 1e10. I would like to be able to do this using the mathtext facilities native to matplotlib, and not have to resort to usetex.

The following diff changes the tick formatter to work as I would like it, but it also probably breaks something else because I have not tested it at all. Please consider it as a starting point.

Paul

Index: ticker.py

···

===================================================================
--- ticker.py (revision 7225)
+++ ticker.py (working copy)
@@ -384,18 +384,10 @@
                  offsetStr = self.format_data(self.offset)
                  if self.offset > 0: offsetStr = '+' + offsetStr
              if self.orderOfMagnitude:
- if self._usetex or self._useMathText:
- sciNotStr = self.format_data(10**self.orderOfMagnitude)
- else:
- sciNotStr = '1e%d'% self.orderOfMagnitude
- if self._useMathText:
- if sciNotStr != '':
- sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
+ sciNotStr = self.format_data(10**self.orderOfMagnitude)
+ if sciNotStr != '':
+ sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
                  s = ''.join(('$',sciNotStr,r'\mathdefault{',offsetStr,'}$'))
- elif self._usetex:
- if sciNotStr != '':
- sciNotStr = r'\times%s' % sciNotStr
- s = ''.join(('$',sciNotStr,offsetStr,'$'))
              else:
                  s = ''.join((sciNotStr,offsetStr))

Pardon me, but I was hasty in sending the diff. The following diff will put a multiplication symbol in the tick label where large numbers are expected, but it also removes any possibility of getting a number written as 1e10, for example, so it definitely is not complete. Hopefully, this is a starting point for someone else to fix this properly.

Thanks,
Paul

Index: lib/matplotlib/ticker.py

···

===================================================================
--- lib/matplotlib/ticker.py (revision 7225)
+++ lib/matplotlib/ticker.py (working copy)
@@ -384,18 +384,10 @@
                  offsetStr = self.format_data(self.offset)
                  if self.offset > 0: offsetStr = '+' + offsetStr
              if self.orderOfMagnitude:
- if self._usetex or self._useMathText:
- sciNotStr = self.format_data(10**self.orderOfMagnitude)
- else:
- sciNotStr = '1e%d'% self.orderOfMagnitude
- if self._useMathText:
- if sciNotStr != '':
- sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
+ sciNotStr = self.format_data(10**self.orderOfMagnitude)
+ if sciNotStr != '':
+ sciNotStr = r'\times\mathdefault{%s}' % sciNotStr
                  s = ''.join(('$',sciNotStr,r'\mathdefault{',offsetStr,'}$'))
- elif self._usetex:
- if sciNotStr != '':
- sciNotStr = r'\times%s' % sciNotStr
- s = ''.join(('$',sciNotStr,offsetStr,'$'))
              else:
                  s = ''.join((sciNotStr,offsetStr))

@@ -476,19 +468,15 @@
              significand = tup[0].rstrip('0').rstrip('.')
              sign = tup[1][0].replace('+', '')
              exponent = tup[1][1:].lstrip('0')
- if self._useMathText or self._usetex:
- if significand == '1':
- # reformat 1x10^y as 10^y
- significand = ''
- if exponent:
- exponent = '10^{%s%s}'%(sign, exponent)
- if significand and exponent:
- return r'%s{\times}%s'%(significand, exponent)
- else:
- return r'%s%s'%(significand, exponent)
+ if significand == '1':
+ # reformat 1x10^y as 10^y
+ significand = ''
+ if exponent:
+ exponent = '10^{%s%s}'%(sign, exponent)
+ if significand and exponent:
+ return r'%s{\times}%s'%(significand, exponent)
              else:
- s = ('%se%s%s' %(significand, sign, exponent)).rstrip('e')
- return s
+ return r'%s%s'%(significand, exponent)
          except IndexError, msg:
              return s