Ignore:
Timestamp:
Jul 4, 2011, 4:03:07 PM (14 years ago)
Author:
aslmd
Message:

MESOSCALE: python graphics. possibility to change color mapping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MESOSCALE/PLOT/PYTHON/scripts/winds.py

    r191 r192  
    1919           winds=True):
    2020
     21    ####################################################################################################################
     22    ### Colorbars http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps?action=AttachFile&do=get&target=colormaps3.png
     23
    2124    #################################
    2225    ### Load librairies and functions
     
    2427    from myplot import getcoord2d,define_proj,makeplotpng,simplinterv,vectorfield,ptitle,latinterv,getproj,wrfinterv,dumpbdy
    2528    from matplotlib.pyplot import contourf, subplot, figure, rcParams, savefig, colorbar
     29    from matplotlib.cm import get_cmap
    2630    import numpy as np
    2731
     
    193197               if dimension == 2:                what_I_plot = field[:,:]
    194198               elif dimension == 3:              what_I_plot = field[i,:,:]
    195            contourf(x, y, what_I_plot, 30)
     199           contourf( x, y, what_I_plot, 30, cmap = get_cmap(name=colorb) )
    196200           if colorb:     colorbar(fraction=0.05,pad=0.1)
    197201
     
    257261    parser.add_option('-n', action='store', dest='numplot',     type="int",     default=4,     help='number of plots (def=1)(<0: 1 plot of LT -*numplot*)')
    258262    parser.add_option('-i', action='store', dest='interp',      type="int",     default=None,  help='interpolation method (2: press, 3: z-amr, 4:z-als)')
    259     parser.add_option('-c', action='store', dest='colorb',      type="string",  default=None,  help='colorbar')
     263    parser.add_option('-c', action='store', dest='colorb',      type="string",  default=None,  help='change colormap (and draw a colorbar)')
    260264    parser.add_option('-x', action='store_false', dest='winds',                 default=True,  help='flag: no wind vectors')
    261265    (opt,args) = parser.parse_args()
Note: See TracChangeset for help on using the changeset viewer.