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_grid.py

    r5612 r5688  
    2727 
    2828from geoplot.layer_drawer import LayerDrawerBase 
     29from geoplot.colour_bar import ColourBar 
    2930 
    3031from matplotlib.colors import Normalize 
     
    4041                 transparent=False): 
    4142         
    42         self._cmap = None 
     43 
    4344        self._gridDrawer = GridDrawer() 
    4445         
     
    5051         
    5152        self.cdmsVar = cdmsVar 
    52         self.cmap = cmap 
    53         self.cmapRange = cmapRange 
    5453        self.showGridLines = showGridLines 
    5554        self.outline = outline 
    5655         
    57         LayerDrawerBase.__init__(self, gridType, transparent) 
     56        LayerDrawerBase.__init__(self, gridType=gridType, transparent=transparent, cmap=cmap, cmapRange=cmapRange) 
    5857         
    5958    def _drawToAxes(self, axes, xLimits, yLimits): 
     
    7271            basemap = map.basemap         
    7372         
    74         norm = Normalize(self.cmapRange[0], self.cmapRange[1]) 
    75          
     73        norm = self._cb.getNormalize() 
     74                 
    7675        #draw the grid on the axis 
    7776        self._gridDrawer.draw(axes, grid, 
     
    7978                              limits=(xLimits, yLimits), 
    8079                              norm=norm, 
    81                               cmap=self.cmap) 
     80                              cmap=self._cb.getColourMap()) 
    8281                               
    8382     
     
    9291    showGridLines = property(__get_showGridLines, __set_showGridLines)  
    9392     
    94     def __set_cmap(self, value): 
    95         self._cmap = value 
    96          
    97     def __get_cmap(self): 
    98         return self._cmap  
    99      
    100     cmap = property(__get_cmap, __set_cmap) 
    101      
    102     def __set_cmapRange(self, value): 
    103         self._cmapRange = value 
    104          
    105     def __get_cmapRange(self): 
    106         return self._cmapRange 
    107      
    108     cmapRange = property(__get_cmapRange, __set_cmapRange) 
    109      
    11093    def __set_outline(self, value): 
    11194        self._gridDrawer.outline = value 
Note: See TracChangeset for help on using the changeset viewer.