## SF.net SVN: matplotlib:[8881] trunk/toolkits/basemap/lib/mpl_toolkits/ basemap/__init__.py

 SF.net SVN: matplotlib:[8881] trunk/toolkits/basemap/lib/mpl_toolkits/ basemap/__init__.py From: - 2011-01-04 14:16:42 ```Revision: 8881 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8881&view=rev Author: jswhit Date: 2011-01-04 14:16:36 +0000 (Tue, 04 Jan 2011) Log Message: ----------- get parallels to label on correct side when celestial=True Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2011-01-04 14:05:31 UTC (rev 8880) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2011-01-04 14:16:36 UTC (rev 8881) @@ -893,10 +893,17 @@ sequences, or numpy arrays. """ if self.celestial and not inverse: - x = -x + try: + x = -x + except TypeError: + x = [-xx for xx in x] xout,yout = self.projtran(x,y,inverse=inverse) if self.celestial and inverse: - xout = -xout + try: + xout = -xout + except: + xout = [-xx for xx in xout] + return xout,yout def makegrid(self,nx,ny,returnxy=False): @@ -1937,7 +1944,10 @@ if side == 'l': if self.projection in _pseudocyl: lats = np.linspace(-89.99,89,99,nmax) - lons = (self.projparams['lon_0']-180.)*np.ones(len(lats),lats.dtype) + if self.celestial: + lons = (self.projparams['lon_0']+180.)*np.ones(len(lats),lats.dtype) + else: + lons = (self.projparams['lon_0']-180.)*np.ones(len(lats),lats.dtype) xx, yy = self(lons, lats) else: xx = self.llcrnrx*np.ones(yy.shape,yy.dtype) @@ -1946,7 +1956,10 @@ else: if self.projection in _pseudocyl: lats = np.linspace(-89.99,89,99,nmax) - lons = (self.projparams['lon_0']+180.)*np.ones(len(lats),lats.dtype) + if self.celestial: + lons = (self.projparams['lon_0']-180.)*np.ones(len(lats),lats.dtype) + else: + lons = (self.projparams['lon_0']+180.)*np.ones(len(lats),lats.dtype) xx, yy = self(lons, lats) else: xx = self.urcrnrx*np.ones(yy.shape,yy.dtype) @@ -2016,7 +2029,10 @@ t = None if side == 'l': if self.projection in _pseudocyl: - xlab,ylab = self(lon_0-179.9,lat) + if self.celestial: + xlab,ylab = self(lon_0+179.9,lat) + else: + xlab,ylab = self(lon_0-179.9,lat) else: xlab = self.llcrnrx xlab = xlab-xoffset @@ -2031,7 +2047,10 @@ t=ax.text(xlab,yy[n],latlab,horizontalalignment='right',verticalalignment='center',**kwargs) elif side == 'r': if self.projection in _pseudocyl: - xlab,ylab = self(lon_0+179.9,lat) + if self.celestial: + xlab,ylab = self(lon_0-179.9,lat) + else: + xlab,ylab = self(lon_0+179.9,lat) else: xlab = self.urcrnrx xlab = xlab+xoffset This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ```