Index: trunk/tools/drawing_tools.py
===================================================================
--- trunk/tools/drawing_tools.py	(revision 2772)
+++ trunk/tools/drawing_tools.py	(revision 2773)
@@ -15101,2 +15101,210 @@
     return
 
+def shad_simple(vv, vn, vu, xv, yv, vmin, vmax, parameters):
+    """ Function to plot using pcolormesh
+      vv: variable values
+      xv, yv: x,y coordinates
+      vmin, vmax: minimum and maximum rang of the plot
+      parameters = [colorbarn, pos, orientation, fmt]
+        colorbarn: ('auto', 'Reds')
+        pos: position color bar ('auto', 0.85)
+        orientation: position color bar ('auto', 'vertical')
+        fmt: format of cbticks ('auto', '%6g')
+    """
+    fname = 'shad_simple'
+
+    if type(parameters[0]) == type('S'):
+        colorbarn = gen.auto_val(parameters[0], 'Reds')
+        cmapv = plt.get_cmap(colorbarn)
+    else:
+        cmapv = parameters[0]
+
+    splot = plt.pcolormesh(xv, yv, vv, cmap=cmapv, vmin=vmin,      \
+      vmax=vmax)
+    orien = gen.auto_val(parameters[2], 'vertical')
+    cbtkf = gen.auto_val(parameters[3], '%6g')
+
+    if orien == 'horizontal':
+        cbar = plt.colorbar(format=cbtkf, orientation=orien)
+        # From: http://stackoverflow.com/questions/32050030/rotation-of-colorbar-tick-labels-in-matplotlib
+        ticklabels= cbar.ax.get_xticklabels()
+        Nticks = len(ticklabels)
+        ticklabs = []
+        for itick in range(Nticks): ticklabs.append(ticklabels[itick].get_text())
+        cbar.ax.set_xticklabels(ticklabs,rotation=90)
+    else:
+        cbar = plt.colorbar(format=cbtkf, orientation=orien)
+
+    cbar.set_label(gen.latex_text(extrapar[0]) +'('+ gen.units_lunits(extrapar[6]) + \
+      ')')
+
+    return splot
+
+def cnt_simple(vv, xv, yv, vmin, vmax, contkind, parameters):
+    """ Function to plot using contour
+      vv: variables
+      xv, yv: x,y coordinates
+      vmin, vmax: minimum and maximum rang of the plot
+      cntkind: type of contour plot
+        'cmap': as it gets from colorbar
+        'fixc': fixed color [colname], all stright lines
+        'fixsigc': fixed color [colname], >0 stright, <0 dashed  line
+      parameters = [colorbarn/colname, freqv, fmtlabs]
+        colorbarn: ('auto', 'Reds')
+        colname: name of the color ('auto', '#FF0000')
+        freqv: frequency of the lines ('auto', pretty(minxv, maxv, 10))
+        fmtlabs: format of the labels in the contour (None, also possible) ('auto', 
+          '%d')
+    """
+    fname = 'cnt_simple'
+
+    availcontkind = ['cmap', 'fixc', 'fixsigc']
+
+    clabfmt = gen.auto_val(parameters[2], '%d')
+    if clabfmt == 'None': clabmt = None
+
+    if freqv == 'auto':
+        vc = pretty(vmin, vmax, 10)
+    else:
+        vc = np.arange(vmin, vmax+freqv, freqv)
+
+    contkind = ckind.split(',')[0]
+    if contkind == 'cmap':
+        colorval = gen.auto_val(parameters[0], 'Reds') 
+        cplot = plt.contour(xv, yv, vv, levels=vc, cmap=plt.get_cmap(colorval))
+    elif  contkind == 'fixc':
+        colorval = gen.auto_val(parameters[0], '#FF0000') 
+        plt.rcParams['contour.negative_linestyle'] = 'solid'
+        coln = parameters[0]
+        cplot = plt.contour(xv, yv, vv, levels=vc, colors=colorval)
+    elif  contkind == 'fixsigc':
+        colorval = gen.auto_val(parameters[0], '#FF0000') 
+        cplot = plt.contour(xv, yv, vv, levels=vc, colors=colorval)
+    else:
+        print errormsg
+        print '  ' + fname + ': contour kind "' + contkind + '" not defined !!!!!'
+        print '    available ones'. availcontkind
+        quit(-1)
+
+    if clabfmt is not None:
+        plt.clabel(cplot, fmt=clabfmt)
+        mincntS = format(vc[0], clabfmt[1:len(clabfmt)])
+        maxcntS = format(vc[len(vc)-1], clabfmt[1:len(clabfmt)])
+    else:
+        mincntS = '{:g}'.format(vc[0])
+        maxcntS = '{:g}'.format(vc[len(vc)-1])        
+
+    return cplot
+
+def plot_multivar_multikind(infilen, figv, figtitle, mapv=None, legvals=[0,8,1],     \
+  mervals=[8,'#AAAAAA',0,0.5], parvals=[8,'#AAAAAA',0,0.5],                          \
+  coastlvals=[0.25,'#AAAAAA'], countrylvals=[0.25,'#161616'],                        \
+  stslvals=[0.25,'#080808'], close=True):
+    """ Function to plot multiple variables in one figure
+      infilen: name of the file with data
+      mapv= [m,meridians,parallels,x,y]: map environtment (from basemap) [None for 
+        no map]
+      figv = {'lvars': ['vari', ...], 'vari': [valsi,drawtype,minv,maxv,dtypev]}: 
+        dictionary with the information of the variables
+         'lvars': key with a sorted list of the variables to plot
+          vari: a sort of name to be used in `variables_values'
+          valsi: matrix values to plot
+          drawtype: type of figure to draw with this variable
+            'shad': shadow
+            'cnt_fixsigc': contour single color changing line-type in pos/neg values
+          minv, maxv: minimum and maximum range for the variable (outside masked)
+          dtypev: values for drawtype
+            'shad': [colorbarn, pos, orientation]
+               colorbarn: ('auto', 'Reds')
+               pos: position color bar ('auto', 0.85)
+               orientation: position color bar ('auto', 'vertical')
+            'cnt_cmap': as it gets from [colorbar, freqv, cfmt]
+               colorbar: color bar ('auto', 'Reds')
+               freqv: frequency of lines ('auto', pretty(minxv, maxv, 10))  
+            'cnt_fixc': fixed color [colorline, freqv, cfmt], all stright lines
+               colorline: color of the lines ('auto', 'k')
+               freqv: frequency of lines ('auto', pretty(minxv, maxv, 10))
+            'cnt_fixsigc': [colorline, freqv, cfmt], fixed color [colname], >0 stright,
+                 <0 dashed  line
+               colorline: color of the lines ('auto', 'k')
+               freqv: frequency of lines ('auto', pretty(minxv, maxv, 10))
+      figtitle: title of the figure
+      mervals = values for the meridians [fontsize, color line, labels rotation, 
+        line width] ([8,'#AAAAAA', 0, 0.5], default)
+      parvals = values for the parallels [fontsize, color line, labels rotation, 
+        line width] ([8,'#AAAAAA', 0, 0.5], default)
+      coastlvals = values for the coastline [line width, color line] None for any
+        ([0.25,'#161616'], default)
+      countrylvals = values for the countries [line width, color line] None for any
+        ([0.25, '#161616'], default)
+      ststlvals = values for the states [line width, color line] None for any (None,
+        default) 
+    """
+    fname = 'plot_multivar_multikind'
+
+    availfigt = ['shad', 'cnt_cmap', 'cnt_fixc', 'cnt_fixsigc']
+
+    # Preparing environtment
+    lvars = figv['lvars']
+    var1 = lvars[0]
+    dvar1 = figv[var1]
+    var1v = dvar1[0]
+    dx = var1v.shape[1]
+    dy = var1v.shape[0]
+
+    if mapv is not None:
+        m = mapv[0]
+        meridians = mapv[1]
+        parallels = mapv[2]
+        x = mapv[3]
+        y = mapv[4]
+    else:
+        xv = np.arange(dx)
+        yv = np.arange(dy)
+        x, y = np.meshgrid(xv, yv)
+
+    for varn in lvars:
+        dvari = figv[varn]
+        valsi = dvari[0]
+        figt = dvari[1]
+        vn = dvari[2]
+        vx = dvari[3]
+        parfigt = dvari[4]
+
+        if figt == 'cnt_cmap':
+            figk = 'cmap'
+            ifp = cont_simple(valsi, x, y, vn, vx, figk, parfigt)
+        elif figt == 'cnt_fixc':
+            figk = 'fixc'
+            ifp = cont_simple(valsi, x, y, vn, vx, figk, parfigt)
+        elif figt == 'cnt_fixsigc':
+            figk = 'fixsigc'
+            ifp = cont_simple(valsi, x, y, vn, vx, figk, parfigt)
+        elif figt == 'shad':
+            ifp = shad_simple(valsi, x, y, vn, vx, parfigt)
+        else:
+            print errormsg
+            print '  ' + fname + ": type of figure '" + figt + "' not ready !!"
+            print '    available ones:', availfigt
+            quit(-1)
+
+    if mapv is not None:
+
+        if coastlvals is not None: 
+            m.drawcoastlines(linewidth=coastlvals[0], color=coastlvals[1])
+        if countrylvals is not None: 
+            m.drawcountries(linewidth=countrylvals[0], color=countrylvals[1])
+        if stslvals is not None: 
+            m.drawstates(linewidth=stslvals[0], color=stslvals[1])
+
+        m.drawmeridians(meridians, labels=[True,False,False,True],                   \
+          fontsize=mervals[0], color=mervals[1], rotation=mervals[2],                \
+          linewidth=mervals[3])
+        m.drawparallels(parallels, labels=[True,False,False,True],                   \
+          fontsize=parvals[0], color=parvals[1], rotation=parvals[2],                \
+          linewidth=parvals[3])
+
+    plt.title(figtitle)
+
+    output_kind(kfig, fign, close)
+
