Changeset 17654


Ignore:
Timestamp:
04/04/14 19:47:11 (11 years ago)
Author:
cborstad
Message:

NEW: overlay plotting capability in python

Location:
issm/trunk-jpl/src/m/plot
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/plot_manager.py

    r17497 r17654  
    1 
    21try:
    32        import pylab as p
     
    1110from plot_unit import plot_unit
    1211from applyoptions import applyoptions
     12from plot_overlay import plot_overlay
    1313
    1414def plot_manager(md,options,subplotwidth,nlines,ncols,i):
     
    2424        #parse options and get a structure of options
    2525        options=checkplotoptions(md,options)
    26         #print 'options:', options
    2726
    2827        #get data to be plotted
    2928        data=options.getfieldvalue('data');
     29
     30        #initialize plot handle variable
     31        handle=None
     32
     33        ##basemap plot
     34        #if options.exist('basemap'):
     35        #       plot_basemap(md,data,options,nlines,ncols,i)
     36
     37        #overlay plot
     38        if options.exist('overlay'):
     39                handle=plot_overlay(md,data,options,nlines,ncols,i)
     40                options.addfielddefault('alpha',0.5)
     41                options.addfielddefault('xlim',[min(md.mesh.x),max(md.mesh.x)])
     42                options.addfielddefault('ylim',[min(md.mesh.y),max(md.mesh.y)])
    3043
    3144        #figure out if this is a special plot
     
    3649                        plot_mesh(md,options,nlines,ncols,i)
    3750                        return
     51                elif data.lower()=='none':
     52                        print 'no data provided to plot (TODO: write plot_none.py)'
     53                        return
    3854                else:
    3955                        print "WARNING: '%s' is not implemented or is not a valid string for option 'data'" % data
     
    4258        #else:
    4359                #print "'data' not a string, plotting model properties yet to be implemented..."
    44 
    45         #Overlay plot
    4660
    4761        #Gridded plot
     
    5670
    5771        #standard plot
    58         p.subplot(nlines,ncols,i,aspect='equal')
     72        if not handle:
     73                p.subplot(nlines,ncols,i,aspect='equal')
    5974
    6075        #plot unit
  • issm/trunk-jpl/src/m/plot/plot_unit.py

    r17643 r17654  
    2121   #number of colorlevels for plots
    2222   colorlevels=options.getfieldvalue('colorlevels',256)
    23    
     23
     24   alpha=options.getfieldvalue('alpha',1)
     25
    2426   #colormap
    2527   cmap=options.getfieldvalue('colormap',mpl.cm.gnuplot2)
     
    5052        #node plot
    5153        if is2d:
    52                 p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm)
     54                p.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha)
    5355                if edgecolor != 'None':
    5456                        p.triplot(x,y,elements,color=edgecolor)
Note: See TracChangeset for help on using the changeset viewer.