Changeset 13417


Ignore:
Timestamp:
09/21/12 17:47:14 (12 years ago)
Author:
cborstad
Message:

NEW: processmesh and applyoptions for python plotting, some options enabled

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

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/classes/plotoptions.py

    r13411 r13417  
    9393                                        if not plotnum: continue
    9494
     95                                        # '#all'
    9596                                        elif 'all' in plotnum:
    9697                                                for j in xrange(numberofplots):
    9798                                                        self.list[j].addfield(field,rawlist[i][1])
    9899
     100                                        # '#i-j'
    99101                                        elif '-' in plotnum:
    100102                                                nums=plotnum.split('-')
  • issm/trunk-jpl/src/m/plot/plot_mesh.py

    r13411 r13417  
    11import pylab as p
    2 import matplotlib.tri as tri
     2from processmesh import processmesh
     3from applyoptions import applyoptions
    34
    45def plot_mesh(md,options,nlines,ncols,i):
     
    1213        '''
    1314
    14         #TODO: implement processmesh
    15         x=md.mesh.x
    16         y=md.mesh.y
    17         elements=md.mesh.elements
    18         elements=elements-1 #since python indexes from zero
     15        x,y,z,elements,is2d=processmesh(md,[],options)
    1916
    20         p.subplot(nlines,ncols,i)
    21         p.triplot(x,y,elements)
    22         p.title('Mesh')
     17        if is2d:
     18                p.subplot(nlines,ncols,i)
     19                p.triplot(x,y,elements)
     20        else:
     21                print 'WARNING: only 2D mesh plot is currently implemented'
    2322       
    24         print 'WARNING: options passed to plot_mesh not implemented yet'
     23        #apply options
     24        options.addfielddefault('title','Mesh')
     25        applyoptions(md,[],options)
  • issm/trunk-jpl/src/m/plot/plotmodel.py

    r13411 r13417  
    11import pylab as p
    22#from pairoptions import *
    3 from plotoptions import *
    4 from plot_manager import *
     3from plotoptions import plotoptions
     4from plot_manager import plot_manager
     5from math import ceil, sqrt
    56
    67def plotmodel(md,*args):
     
    1314
    1415        #get number of subplots
    15         subplotwidth=math.ceil(math.sqrt(options.numberofplots))
     16        subplotwidth=ceil(sqrt(options.numberofplots))
    1617       
    1718        #if nlines and ncols specified, then bypass
     
    4445                #plots will be visible by default if ipython is run in interactive mode (invoked by ipython --pylab)
    4546                #handling the 'visible' option will need some check on whether ipython is currently in interactive or non-interactive mode
    46                 p.figure(figurenumber)
     47
     48                #if figsize specified
     49                if options.list[0].exist('figsize'):
     50                        figsize=options.list[0].getfieldvalue('figsize')
     51                        p.figure(figurenumber,figsize=figsize)
     52                else:
     53                        p.figure(figurenumber)
     54
    4755       
    48                 try:
    49                         for i in xrange(numberofplots):
    50                                 plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],subplotwidth,nlines,ncols,i)
    51                 except StandardError:
    52                         print 'error in plot_manager'
     56                #try:
     57                for i in xrange(numberofplots):
     58                        plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],subplotwidth,nlines,ncols,i)
     59                #except StandardError:
     60                #       print 'error in plot_manager'
    5361        else:
    5462                raise StandardError('plotmodel error message: no output data found.')
Note: See TracChangeset for help on using the changeset viewer.