Index: trunk/tools/drawing_tools.py
===================================================================
--- trunk/tools/drawing_tools.py	(revision 932)
+++ trunk/tools/drawing_tools.py	(revision 933)
@@ -1461,4 +1461,209 @@
     return lonvv, latvv
 
+
+def transform(vals, trans, dxv='0', dyv='0', dxt='0', dyt='0', dxl='0',         \
+  dyl='0', dxtit='0', dytit='0'):
+    """ Function to transform the values and the axes
+      vals= values to transform
+      trans= '|' separated list of operations of transformation
+        'transpose': Transpose matrix of values (x-->y, y-->x)
+        'flip@[x/y]': Flip the given axis
+      d[x/y]v= original values for the [x/y]-axis
+      d[x/y]t= original ticks for the [x/y]-axis
+      d[x/y]l= original tick-labels for the [x/y]-axis
+      d[x/y]tit= original titels for the [x/y]-axis
+
+    >>> mat = np.arange(15).reshape(3,5)
+    >>> xvals = np.zeros((3,5), dtype=np.float)
+    >>> yvals = np.zeros((3,5), dtype=np.float)
+    >>> for i in range(5):
+    >>>     xvals[:,i] = -1.25 + i*0.5
+    >>> for j in range(3):
+    >>>     yvals[j,:] = 40.25 + j*0.5
+    >>> xticks = np.array([-1.25, -0.25, 0.25])
+    >>> yticks = np.array([40.25, 41.25])
+    >>> xticklab = ['1.25 W', '0.25 W', '0,25 E']
+    >>> yticklab = ['40.25 N', '41.25 N']
+    >>> xtit = 'Longitude'
+    >>> ytit = 'Latitude'
+    >>> nv, ndxv, ndyv, ndxt, ndyt, dxl, ndyl, ndxT, ndyT = transform(mat, 'transpose', \
+      xvals, yvals, xticks, yticks, xticklab, yticklab, xtit, ytit)
+    [[ 0  5 10]
+     [ 1  6 11]
+     [ 2  7 12]
+     [ 3  8 13]
+     [ 4  9 14]]
+    [[ 40.25  40.75  41.25]
+     [ 40.25  40.75  41.25]
+     [ 40.25  40.75  41.25]
+     [ 40.25  40.75  41.25]
+     [ 40.25  40.75  41.25]]
+    [[-1.25 -1.25 -1.25]
+     [-0.75 -0.75 -0.75]
+     [-0.25 -0.25 -0.25]
+     [ 0.25  0.25  0.25]
+     [ 0.75  0.75  0.75]] 
+    [ 40.25  41.25] 
+    [-1.25 -0.25  0.25] 
+    ['41.25 N', '40.25 N'] 
+    ['0,25 E', '0.25 W', '1.25 W'] 
+    Latitude 
+    Longitude
+    """
+    fname = 'transform'
+
+    transforms = trans.split('|')
+    Ntransforms = len(transforms)
+
+    newvals = vals.copy()
+    wdvx = False
+    if dxv != '0':
+        newdxv = dxv.copy()
+        wdvx = True
+    else:
+        newdxv = None
+    wdvy = False
+    if dyv != '0':
+        newdyv = dyv.copy()
+        wdvy = True
+    else:
+        newdyv = None
+
+    wdtx = False
+    if dxt != '0':
+        newdxt = dxt.copy()
+        wdtx = True
+    else:
+        newdxt = None
+    wdty = False
+    if dyt != '0':
+        newdyt = dyt.copy()
+        wdty = True
+    else:
+        newdyt = None
+
+    wdlx = False
+    if dxl != '0':
+        newdxl = list(dxl)
+        wdlx = True
+    else:
+        newdxl = None
+    wdly = False
+    if dyl != '0':
+        newdyl = list(dyl)
+        wdly = True
+    else:
+        newdyl = None
+
+    wdTx = False
+    if dxt != '0':
+        newdxtit = str(dxtit)
+        wdTx = True
+    else:
+        newdxtit = None
+    wdTy = False
+    if dyt != '0':
+        newdytit = str(dytit)
+        wdTy = True
+    else:
+        newdytit = None
+
+    dx = newvals.shape[0]
+    dy = newvals.shape[1]
+
+    for transform in transforms:
+        if transform == 'transpose':
+            newvals = np.transpose(newvals)
+            if wdvx and wdvy:
+                copy = newdxv.copy()
+                newdxv = np.transpose(newdyv)
+                newdyv = np.transpose(copy)
+#            else:
+#                print errormsg
+#                print '  ' + fname + ": it can not be '" + transform + "' without " +\
+#                  ' both dimxvals:', dxv, ' and dimyvals:', dyv, ' !!'
+#                quit(-1)
+
+            if wdtx and wdtx:
+                copy = newdxt.copy()
+                newdxt = np.transpose(newdyt)
+                newdyt = np.transpose(copy)
+#            else:
+#                print errormsg
+#                print '  ' + fname + ": it can not be '" + transform + "' without " +\
+#                  ' both dimxtickvals:', dxt, ' and dimytickvals:', dyt, ' !!'
+#                quit(-1)
+
+            if wdlx and wdly:
+                copy = list(newdxl)
+                newdxl = list(newdyl[::-1])
+                newdyl = list(copy[::-1])
+#            else:
+#                print errormsg
+#                print '  ' + fname + ": it can not be '" + transform + "' without " +\
+#                  ' both dimxlabels:', dxl, ' and dimylabels:', dyl, ' !!'
+#                quit(-1)
+
+            if wdTx and wdTy:
+                copy = str(newdxtit)
+                newdxtit = str(newdytit)
+                newdytit = str(copy)
+#            else:
+#                print errormsg
+#                print '  ' + fname + ": it can not be '" + transform + "' without " +\
+#                  ' both dimx title:', dxtit, ' and dimytitle:', dytit, ' !!'
+#                quit(-1)
+
+        elif transform[0:4] == 'flip':
+            if transform.find('@') == -1:
+                print errormsg
+                print '  ' + fname + ": no ax given for '" + transform + "' !!"
+                quit(-1)
+                
+            flip = transform.split('@')[1]
+            if flip == 'x':
+                newvals = newvals[...,::-1]
+                if dv:
+                    newdxv = newdxv[...,::-1]
+                if dt:
+                    newdxt = newdxt[::-1]
+                if dl:
+                    newdxl = newdxl[::-1]
+            elif flip == 'y':
+                newvals = newvals[...,::-1,:]
+                if dv:
+                    newdyv = newdyv[...,::-1,:]
+                if dt:
+                    newdyt = newdyt[::-1]
+                if dl:
+                    newdyl = newdyl[::-1]
+            elif flip == 'z':
+                newvals = newvals[...,::-1,:,:]
+        else:
+            print errormsg
+            print '  '+ fname + ": transformation '" + transform + "' not ready!!"
+            quit(-1)
+
+    return newvals, newdxv, newdyv, newdxt, newdyt, newdxl, newdyl, newdxtit, newdytit
+
+#mat = np.arange(15).reshape(3,5)
+#xvals = np.zeros((3,5), dtype=np.float)
+#yvals = np.zeros((3,5), dtype=np.float)
+#for i in range(5):
+#    xvals[:,i] = -1.25 + i*0.5
+#for j in range(3):
+#    yvals[j,:] = 40.25 + j*0.5
+#xticks = np.array([-1.25, -0.25, 0.25])
+#yticks = np.array([40.25, 41.25])
+#xticklab = ['1.25 W', '0.25 W', '0,25 E']
+#yticklab = ['40.25 N', '41.25 N']
+#xtit = 'Longitude'
+#ytit = 'Latitude'
+#nv, ndxv, ndyv, ndxt, ndyt, dxl, ndyl, ndxT, ndyT = transform(mat, 'transpose', \
+#      xvals, yvals, xticks, yticks, xticklab, yticklab, xtit, ytit)
+
+#print nv, ndxv, ndyv, ndxt, ndyt, dxl, ndyl, ndxT, ndyT
+#quit()
+
 #######    #######    #######    #######    #######    #######    #######    #######    #######    #######
 
@@ -3977,200 +4182,4 @@
 #quit()
 
-def transform(vals, trans, dxv= None, dyv= None, dxt= None, dyt= None, dxl= None,    \
-  dyl= None, dxtit= None, dytit= None):
-    """ Function to transform the values and the axes
-      vals= values to transform
-      trans= '|' separated list of operations of transformation
-        'transpose': Transpose matrix of values (x-->y, y-->x)
-        'flip@[x/y]': Flip the given axis
-      d[x/y]v= original values for the [x/y]-axis
-      d[x/y]t= original ticks for the [x/y]-axis
-      d[x/y]l= original tick-labels for the [x/y]-axis
-      d[x/y]tit= original titels for the [x/y]-axis
-
-    >>> mat = np.arange(15).reshape(3,5)
-    >>> xvals = np.zeros((3,5), dtype=np.float)
-    >>> yvals = np.zeros((3,5), dtype=np.float)
-    >>> for i in range(5):
-    >>>     xvals[:,i] = -1.25 + i*0.5
-    >>> for j in range(3):
-    >>>     yvals[j,:] = 40.25 + j*0.5
-    >>> xticks = np.array([-1.25, -0.25, 0.25])
-    >>> yticks = np.array([40.25, 41.25])
-    >>> xticklab = ['1.25 W', '0.25 W', '0,25 E']
-    >>> yticklab = ['40.25 N', '41.25 N']
-    >>> xtit = 'Longitude'
-    >>> ytit = 'Latitude'
-    >>> nv, ndxv, ndyv, ndxt, ndyt, dxl, ndyl, ndxT, ndyT = transform(mat, 'transpose', \
-      xvals, yvals, xticks, yticks, xticklab, yticklab, xtit, ytit)
-    [[ 0  5 10]
-     [ 1  6 11]
-     [ 2  7 12]
-     [ 3  8 13]
-     [ 4  9 14]]
-    [[ 40.25  40.75  41.25]
-     [ 40.25  40.75  41.25]
-     [ 40.25  40.75  41.25]
-     [ 40.25  40.75  41.25]
-     [ 40.25  40.75  41.25]]
-    [[-1.25 -1.25 -1.25]
-     [-0.75 -0.75 -0.75]
-     [-0.25 -0.25 -0.25]
-     [ 0.25  0.25  0.25]
-     [ 0.75  0.75  0.75]] 
-    [ 40.25  41.25] 
-    [-1.25 -0.25  0.25] 
-    ['41.25 N', '40.25 N'] 
-    ['0,25 E', '0.25 W', '1.25 W'] 
-    Latitude 
-    Longitude
-    """
-    fname = 'transform'
-
-    transforms = trans.split('|')
-    Ntransforms = len(transforms)
-
-    newvals = vals.copy()
-    dvx = False
-    if dxv is not None:
-        newdxv = dxv.copy()
-        dvx = True
-    else:
-        newdxv = None
-    dvy = False
-    if dyv is not None:
-        newdyv = dyv.copy()
-        dvy = True
-    else:
-        newdyv = None
-
-    dtx = False
-    if dxt is not None:
-        newdxt = dxt.copy()
-        dtx = True
-    else:
-        newdxt = None
-    dty = False
-    if dyt is not None:
-        newdyt = dyt.copy()
-        dty = True
-    else:
-        newdyt = None
-
-    dlx = False
-    if dxt is not None:
-        newdxl = list(dxl)
-        dlx = True
-    else:
-        newdxl = None
-    dly = False
-    if dyt is not None:
-        newdyl = list(dyl)
-        dly = True
-    else:
-        newdyl = None
-
-    dTx = False
-    if dxt is not None:
-        newdxtit = str(dxtit)
-        dTx = True
-    else:
-        newdxtit = None
-    dTy = False
-    if dyt is not None:
-        newdytit = str(dytit)
-        dTy = True
-    else:
-        newdytit = None
-
-    dx = newvals.shape[0]
-    dy = newvals.shape[1]
-
-    for transform in transforms:
-        if transform == 'transpose':
-            newvals = np.transpose(newvals)
-            if dvx and dvy:
-                copy = newdxv.copy()
-                newdxv = np.transpose(newdyv)
-                newdyv = np.transpose(copy)
-            else:
-                print errormsg
-                print '  ' + fname + ": it can not be '" + transform + "' without " +\
-                  ' both dimxvals:', dxv, ' and dimyvals:', dyv, ' !!'
-                quit(-1)
-            if dtx and dtx:
-                copy = newdxt.copy()
-                newdxt = np.transpose(newdyt)
-                newdyt = np.transpose(copy)
-            else:
-                print errormsg
-                print '  ' + fname + ": it can not be '" + transform + "' without " +\
-                  ' both dimxtickvals:', dxt, ' and dimytickvals:', dyt, ' !!'
-                quit(-1)
-            if dlx and dly:
-                copy = list(newdxl)
-                newdxl = list(newdyl[::-1])
-                newdyl = list(copy[::-1])
-            else:
-                print errormsg
-                print '  ' + fname + ": it can not be '" + transform + "' without " +\
-                  ' both dimxlabels:', dxl, ' and dimylabels:', dyl, ' !!'
-                quit(-1)
-            if dTx and dTy:
-                copy = str(newdxtit)
-                newdxtit = str(newdytit)
-                newdytit = str(copy)
-            else:
-                print errormsg
-                print '  ' + fname + ": it can not be '" + transform + "' without " +\
-                  ' both dimx title:', dxtit, ' and dimytitle:', dytit, ' !!'
-                quit(-1)
-
-        elif transform[0:4] == 'flip':
-            flip = transform.split('@')[1]
-            if flip == 'x':
-                newvals = newvals[...,::-1]
-                if dv:
-                    newdxv = newdxv[...,::-1]
-                if dt:
-                    newdxt = newdxt[::-1]
-                if dl:
-                    newdxl = newdxl[::-1]
-            elif flip == 'y':
-                newvals = newvals[...,::-1,:]
-                if dv:
-                    newdyv = newdyv[...,::-1,:]
-                if dt:
-                    newdyt = newdyt[::-1]
-                if dl:
-                    newdyl = newdyl[::-1]
-            elif flip == 'z':
-                newvals = newvals[...,::-1,:,:]
-        else:
-            print errormsg
-            print '  '+ fname + ": transformation '" + transform + "' not ready!!"
-            quit(-1)
-
-    return newvals, newdxv, newdyv, newdxt, newdyt, newdxl, newdyl, newdxtit, newdytit
-
-#mat = np.arange(15).reshape(3,5)
-#xvals = np.zeros((3,5), dtype=np.float)
-#yvals = np.zeros((3,5), dtype=np.float)
-#for i in range(5):
-#    xvals[:,i] = -1.25 + i*0.5
-#for j in range(3):
-#    yvals[j,:] = 40.25 + j*0.5
-#xticks = np.array([-1.25, -0.25, 0.25])
-#yticks = np.array([40.25, 41.25])
-#xticklab = ['1.25 W', '0.25 W', '0,25 E']
-#yticklab = ['40.25 N', '41.25 N']
-#xtit = 'Longitude'
-#ytit = 'Latitude'
-#nv, ndxv, ndyv, ndxt, ndyt, dxl, ndyl, ndxT, ndyT = transform(mat, 'transpose', \
-#      xvals, yvals, xticks, yticks, xticklab, yticklab, xtit, ytit)
-
-#print nv, ndxv, ndyv, ndxt, ndyt, dxl, ndyl, ndxT, ndyT
-#quit()
-
 def plot_2D_shadow_time(varsv,vnames,dimxv,dimyv,dimxu,dimyu,dimn,colorbar,vs,uts,   \
   vtit,kfig,reva,taxis,tpos,tlabs,ifclose):
@@ -4651,5 +4660,5 @@
 
 def plot_2D_shadow_contour_time(varsv,varcv,vnames,valv,timv,timpos,timlab,valu,     \
-  timeu,axist,dimn,colorbar,ckind,clabfmt,vs,vc,uts,vtit,kfig,reva,mapv):
+  timeu,axist,dimn,colorbar,ckind,clabfmt,vs,vc,uts,vtit,kfig,reva):
     """ Adding labels and other staff to the graph
       varsv= 2D values to plot with shading
@@ -4678,15 +4687,4 @@
         * 'transpose': reverse the axes (x-->y, y-->x)
         * 'flip'@[x/y]: flip the axis x or y
-      mapv= map characteristics: [proj],[res]
-        see full documentation: http://matplotlib.org/basemap/
-        [proj]: projection
-          * 'cyl', cilindric
-          * 'lcc', lamvbert conformal
-        [res]: resolution:
-          * 'c', crude
-          * 'l', low
-          * 'i', intermediate
-          * 'h', high
-          * 'f', full
     """
 ##    import matplotlib as mpl
@@ -4700,213 +4698,46 @@
         quit()
 
+    # Usually axis > x must be the time, thus...
+    dimxv0 = valv.copy()
+    dimyv0 = timv.copy()
+    dimxt0 = np.array(pretty_int(valv.min(),valv.max(),10))
+    dimyt0 = np.array(timpos)
+    dimxl0 = []
+    for i in range(len(dimxt0)): dimxl0.append(str(dimxt0[i]))
+    dimyl0 = list(timlab)
+    dimxT0 = variables_values(dimn[0])[0] + ' (' + units_lunits(valu) + ')'
+    dimyT0 = timeu
+
     if axist == 'x':
-        dimxv0 = timv.copy()
-        dimyv0 = valv.copy()
-        dimxt0 = list(timpos)
-        dimyt0 = None
-        dimxl0 = list(timlab)
-        dimyl0 = None
-    else:
-        dimxv0 = valv.copy()
-        dimyv0 = timv.copy()
-        dimxt0 = None
-        dimyt0 = list(timpos)
-        dimxl0 = None
-        dimyl0 = list(timlab)
-
-    varsv, dimxv, dimyv, dimxt, dimyt, dimxl, dimyl, dimxT, dimyT = transform(varsv, \
-      reva, dimxv, dimyv, dimxt, dimyt, dimxl, dimyl)
-
-    if reva[0:4] == 'flip':
-        reva0 = 'flip'
-        if len(reva.split('@')) != 2:
-             print errormsg
-             print '  ' + fname + ': flip is given', reva, 'but not axis!'
-             quit(-1)
-    else:
-        reva0 = reva
-
-    if reva0 == 'transpose':
-        if axist == 'x': 
-            axist = 'y'
-        else:
-            axist = 'x'
-
-    if not mapv is None:
-        if len(dimxv[:].shape) == 3:
-            lon0 = dimxv[0,]
-            lat0 = dimyv[0,]
-        elif len(dimxv[:].shape) == 2:
-            lon0 = dimxv[:]
-            lat0 = dimyv[:]
-        elif len(dimxv[:].shape) == 1:
-            lon00 = dimxv[:]
-            lat00 = dimyv[:]
-            lon0 = np.zeros( (len(lat00),len(lon00)), dtype=np.float )
-            lat0 = np.zeros( (len(lat00),len(lon00)), dtype=np.float )
-
-            for iy in range(len(lat00)):
-                lon0[iy,:] = lon00
-            for ix in range(len(lon00)):
-                lat0[:,ix] = lat00
-        if reva0 == 'transpose':
-            print '  reversing the axes of the figure (x-->y, y-->x)!!'
-            varsv = np.transpose(varsv)
-            varcv = np.transpose(varcv)
-            lon0 = np.transpose(lon0)
-            lat0 = np.transpose(lat0)
-
-        map_proj=mapv.split(',')[0]
-        map_res=mapv.split(',')[1]
-
-        dx = lon0.shape[1]
-        dy = lon0.shape[0]
-
-        nlon = lon0[0,0]
-        xlon = lon0[dy-1,dx-1]
-        nlat = lat0[0,0]
-        xlat = lat0[dy-1,dx-1]
-
-# Thats too much! :)
-#        if lonlatLims is not None:
-#            print '  ' + fname + ': cutting the domain to plot !!!!'
-#            plt.xlim(lonlatLims[0], lonlatLims[2])
-#            plt.ylim(lonlatLims[1], lonlatLims[3])
-#            print '    limits: W-E', lonlatLims[0], lonlatLims[2]
-#            print '    limits: N-S', lonlatLims[1], lonlatLims[3]
-
-#            if map_proj == 'cyl':
-#                nlon = lonlatLims[0]
-#                nlat = lonlatLims[1]
-#                xlon = lonlatLims[2]
-#                xlat = lonlatLims[3]
-#            elif map_proj == 'lcc':
-#                lon2 = (lonlatLims[0] + lonlatLims[2])/2.
-#                lat2 = (lonlatLims[1] + lonlatLims[3])/2.
-#                nlon =  lonlatLims[0]
-#                xlon =  lonlatLims[2]
-#                nlat =  lonlatLims[1]
-#                xlat =  lonlatLims[3]
-
-        lon2 = lon0[dy/2,dx/2]
-        lat2 = lat0[dy/2,dx/2]
-
-        print 'lon2:', lon2, 'lat2:', lat2, 'SW pt:', nlon, ',', nlat, 'NE pt:',     \
-          xlon, ',', xlat
-
-        if map_proj == 'cyl':
-            m = Basemap(projection=map_proj, llcrnrlon=nlon, llcrnrlat=nlat,         \
-              urcrnrlon=xlon, urcrnrlat= xlat, resolution=map_res)
-        elif map_proj == 'lcc':
-            m = Basemap(projection=map_proj, lat_0=lat2, lon_0=lon2, llcrnrlon=nlon, \
-              llcrnrlat=nlat, urcrnrlon=xlon, urcrnrlat= xlat, resolution=map_res)
-
-        if len(dimxv.shape) == 1:
-            lons, lats = np.meshgrid(dimxv, dimyv)
-        else:
-            if len(dimxv.shape) == 3:
-                lons = dimxv[0,:,:]
-                lats = dimyv[0,:,:]
-            else:
-                lons = dimxv[:]
-                lats = dimyv[:]
- 
-        x,y = m(lons,lats)
-
-    else:
-        if reva0  == 'transpose':
-            print '  reversing the axes of the figure (x-->y, y-->x)!!'
-            varsv = np.transpose(varsv)
-            varcv = np.transpose(varcv)
-            dimn0 = []
-            dimn0.append(dimn[1] + '')
-            dimn0.append(dimn[0] + '')
-            dimn = dimn0
-            if len(dimyv.shape) == 2:
-                x = np.transpose(dimyv)
-            else:
-                if len(dimxv.shape) == 2:
-                    ddx = len(dimyv)
-                    ddy = dimxv.shape[1]
-                else:
-                    ddx = len(dimyv)
-                    ddy = len(dimxv)
-    
-                x = np.zeros((ddy,ddx), dtype=np.float)
-                for j in range(ddy):
-                    x[j,:] = dimyv
-
-            if len(dimxv.shape) == 2:
-                y = np.transpose(dimxv)
-            else:
-                if len(dimyv.shape) == 2:
-                    ddx = dimyv.shape[0]
-                    ddy = len(dimxv)
-                else:
-                    ddx = len(dimyv)
-                    ddy = len(dimxv)
-
-                y = np.zeros((ddy,ddx), dtype=np.float)
-                for i in range(ddx):
-                    y[:,i] = dimxv
-        else:
-            if len(dimxv.shape) == 2:
-                x = dimxv
-            else:
-                if len(dimyv.shape) == 1:
-                    x = np.zeros((len(dimyv),len(dimxv)), dtype=np.float)
-                    for j in range(len(dimyv)):
-                        x[j,:] = dimxv
-                else:
-                    x = np.zeros((dimyv.shape), dtype=np.float)
-                    if x.shape[0] == dimxv.shape[0]:
-                        for j in range(x.shape[1]):
-                            x[:,j] = dimxv
-                    else:
-                        for j in range(x.shape[0]):
-                            x[j,:] = dimxv
-
-            if len(dimyv.shape) == 2:
-                y = dimyv
-            else:
-                if len(dimxv.shape) == 1:
-                    y = np.zeros((len(dimyv),len(dimxv)), dtype=np.float)
-                    for i in range(len(dimxv)):
-                        y[:,i] = dimyv
-                else:
-                    y = np.zeros((dimxv.shape), dtype=np.float)
-                    if y.shape[0] == dimyv.shape[0]:
-                        for i in range(y.shape[1]):
-                            y[:,i] = dimyv
-                    else:
-                        for i in range(y.shape[0]):
-                            y[i,:] = dimyv
+        reva = 'transpose'
+
+    if reva is not None:
+        varcv, dimxv, dimyv, dimxt, dimyt, dimxl, dimyl, dimxT, dimyT =              \
+          transform(varcv, reva)
+        varsv, dimxv, dimyv, dimxt, dimyt, dimxl, dimyl, dimxT, dimyT =              \
+          transform(varsv, reva, dxv=dimxv0, dyv=dimyv0, dxt=dimxt0, dyt=dimyt0,     \
+          dxl=dimxl0, dyl=dimyl0, dxtit=dimxT0, dytit=dimyT0)
+    else:
+        dimxv = dimxv0
+        dimyv = dimyv0
+        dimxt = dimxt0
+        dimyt = dimyt0
+        dimxl = dimxl0
+        dimyl = dimyl0
+        dimxT = dimxT0
+        dimyT = dimyT0
 
     dx=varsv.shape[1]
     dy=varsv.shape[0]
-    
+
+    x,y = gen.lonlat2D(dimxv,dimyv)
+
     plt.rc('text', usetex=True)
 
-    if axist == 'x':
-        valpos = pretty_int(y.min(),y.max(),10)
-        vallabels = list(valpos)
-        for i in range(len(vallabels)): vallabels[i] = str(vallabels[i])
-    else:
-        valpos = pretty_int(x.min(),x.max(),10)
-        vallabels = list(valpos)
-        for i in range(len(vallabels)): vallabels[i] = str(vallabels[i])
-
-    if reva0 == 'flip':
-        if reva.split('@')[1] == 'x':
-            varsv[:,0:dx-1] = varsv[:,dx-1:0:-1]
-            varcv[:,0:dx-1] = varcv[:,dx-1:0:-1]
-            plt.xticks(valpos, vallabels[::-1])
-        else:
-            varsv[0:dy-1,:] = varsv[dy-1:0:-1,:]
-            varcv[0:dy-1,:] = varcv[dy-1:0:-1,:]
-            plt.yticks(valpos, vallabels[::-1])
-    else:
-        plt.xlim(0,dx-1)
-        plt.ylim(0,dy-1)
+    plt.xticks(dimxt, dimxl)
+    plt.yticks(dimyt, dimyl)
+
+    plt.xlim(0,dx)
+    plt.ylim(0,dy)
 
     plt.pcolormesh(x, y, varsv, cmap=plt.get_cmap(colorbar), vmin=vs[0], vmax=vs[1])
@@ -4915,5 +4746,4 @@
 # contour
 ##
-    print fname + '; Lluis: shapes x:', x.shape,'y:', y.shape, 'varcv:', varcv.shape
     contkind = ckind.split(',')[0]
     if contkind == 'cmap':
@@ -4925,5 +4755,5 @@
     elif  contkind == 'fixsigc':
         coln = ckind.split(',')[1]
-        cplot = plt.contour(x, y, varcv.transpose(), levels=vc, colors=coln)
+        cplot = plt.contour(x, y, varcv, levels=vc, colors=coln)
     else:
         print errormsg
@@ -4939,28 +4769,9 @@
         maxcntS = '{:g}'.format(vc[len(vc)-1])        
 
-    if not mapv is None:
-        m.drawcoastlines()
-
-        meridians = pretty_int(nlon,xlon,5)
-        m.drawmeridians(meridians,labels=[True,False,False,True])
-        parallels = pretty_int(nlat,xlat,5)
-        m.drawparallels(parallels,labels=[False,True,True,False])
-
-        plt.xlabel('W-E')
-        plt.ylabel('S-N')
-    else:
-        if axist == 'x':
-            plt.xlabel(timeu)
-            plt.xticks(timpos, timlab)
-            plt.ylabel(variables_values(dimn[0])[0] + ' (' + units_lunits(valu) + ')')
-            plt.yticks(valpos, vallabels)
-        else:
-            plt.xlabel(variables_values(dimn[1])[0] + ' (' + units_lunits(valu) + ')')
-            plt.xticks(valpos, vallabels)
-            plt.ylabel(timeu)
-            plt.yticks(timpos, timlab)
+    plt.xlabel(dimxT)
+    plt.ylabel(dimyT)
 
 # set the limits of the plot to the limits of the data
-    plt.axis([x.min(), x.max(), y.min(), y.max()])
+    plt.axis([dimxv.min(), dimxv.max(), dimyv.min(), dimyv.max()])
 
 # units labels
