The function "clabel" does not allow the use of formatters for the label;
this small patch enables their use, so that one can pass in any subclass of
ticker.Formatter in the 'fmt' argument.

Replace the following in contour.py:

   def get_text(self, lev, fmt):
       "get the text of the label"
       if cbook.is_string_like(lev):
           return lev
       else:
           if isinstance(fmt,dict):
               return fmt[lev]
           else:
               return fmt%lev

With the following:

   def get_text(self, lev, fmt):
       "get the text of the label"
       if cbook.is_string_like(lev):
           return lev
       else:
           if isinstance(fmt,dict):
               return fmt[lev]
           elif isinstance(fmt,ticker.Formatter):
               return fmt(lev)
           else:
               return fmt%lev


As you can see, there is only a two line change, but it does enable
formatters.  Perhaps one of the devs can put this in?


-- 
Daniel Hyams
dhy...@gmail.com
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to