Ignore:
Timestamp:
07/09/09 12:52:39 (11 years ago)
Author:
pnorton
Message:

Improved the colour bar code so it now accepts the data array instead of just a minimum + maximum. It also now defaults to creating a Normalize instance with vmin=None and vmax=None instead of 0 and 1.

Also modified the layer_drawer objects to use the ColourBar? class instead of implementing it themselves.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qesdi/geoplot/trunk/lib/geoplot/layer_drawer_contour.py

    r5605 r5688  
    99import StringIO 
    1010import thread 
    11  
    12 from matplotlib.colors import Normalize 
    1311 
    1412from geoplot.contour_drawer import ContourDrawer 
     
    2624         
    2725        self._contourDrawer = ContourDrawer() 
    28          
    29         self.cmap = cmap 
    3026        self.numLines = numLines 
    31         self.cmapRange = cmapRange 
    3227        self.cdmsVar = cdmsVar 
    3328        self.fontSize = fontSize 
    3429        self.labelInterval =labelInterval 
    3530         
    36         LayerDrawerBase.__init__(self, gridType, transparent, projection) 
     31        LayerDrawerBase.__init__(self, gridType=gridType, transparent=transparent, cmap=cmap, cmapRange=cmapRange) 
    3732         
    3833    def _drawToAxes(self, axes, xLimits, yLimits): 
     
    5045            basemap = map.basemap         
    5146         
    52         norm = Normalize(self.cmapRange[0], self.cmapRange[1]) 
    53         self._contourDrawer.draw(axes, grid, normalize=norm, cmap=self.cmap, 
     47        norm = self._cb.getNormalize() 
     48         
     49        self._contourDrawer.draw(axes, grid, normalize=norm, cmap=self._cb.getColourMap(), 
    5450                                 basemap=basemap, fontSize=self.fontSize) 
    5551     
    5652    ### properties ### 
    57          
    58     def __set_cmap(self, value): 
    59         self._cmap = value 
    60          
    61     def __get_cmap(self): 
    62         return self._cmap  
    63      
    64     cmap = property(__get_cmap, __set_cmap) 
    65      
     53           
    6654    def __set_numLines(self, value): 
    6755        self._contourDrawer.numContourLines = value 
     
    8977    labelInterval = property(__get_labelInterval, __set_labelInterval) 
    9078 
    91     def __set_cmapRange(self, value): 
    92         self._cmapRange = value 
    9379         
    94     def __get_cmapRange(self): 
    95         return self._cmapRange 
    96      
    97     cmapRange = property(__get_cmapRange, __set_cmapRange)     
    98          
Note: See TracChangeset for help on using the changeset viewer.