source: issm/oecreview/Archive/21337-21723/ISSM-21474-21475.diff@ 21726

Last change on this file since 21726 was 21726, checked in by Mathieu Morlighem, 8 years ago

CHG added Archive/21337-21723

File size: 5.8 KB
  • ../trunk-jpl/src/m/plot/plot_mesh.py

     
    2626       
    2727        if is2d:
    2828                ax.triplot(x,y,elements)
    29 
    3029        else:
    31                 # fig.delaxes(ax)
    32                 # geom=int(str(axgrid.get_geometry()[0])+str(axgrid.get_geometry()[1])+str(gridindex+1))
    33                 # ax = fig.add_subplot(geom,projection='3d')
    3430                ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)
    3531               
    3632               
  • ../trunk-jpl/src/m/plot/plot_elementnumbering.py

     
    88from applyoptions import applyoptions
    99from plot_icefront import plot_icefront
    1010
    11 def plot_elementnumbering(md,options,fig,ax):
     11def plot_elementnumbering(md,options,fig,axgrid,gridindex):
    1212        '''
    1313        plot_elementnumbering - plot element numberign (starting at 1 matlab and c convention)
    1414
     
    1717
    1818                See also: PLOTMODEL
    1919        '''
     20        x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
     21
     22        ax=axgrid[gridindex]
     23        fig.delaxes(axgrid.cbar_axes[gridindex])
    2024       
    21         x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
     25        if is2d:
     26                ax.triplot(x,y,elements)
     27        else:
     28                ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)
     29
    2230        XLims=[np.min(x),np.max(x)]
    2331        YLims=[np.min(y),np.max(y)]
    2432        #plot mesh
     
    3644        for i,element in enumerate(elements):
    3745                ax.text(np.mean(x[element]),np.mean(y[element]),str(i+1),ha='center',va='center')
    3846               
    39 
    4047        #apply options
    41         options.addfielddefault('title','Element numbers')
     48        options.addfielddefault('title','Element numbers (matlab indexation)')
    4249        options.addfielddefault('colorbar','off')
    43         applyoptions(md,[],options,fig,ax)
     50        applyoptions(md,[],options,fig,axgrid,gridindex)
    4451       
  • ../trunk-jpl/src/m/plot/plot_vertexnumbering.py

     
    1 
    2 
    3 
    41try:
    52        import pylab as p
    63except ImportError:
     
    118from applyoptions import applyoptions
    129from plot_icefront import plot_icefront
    1310
    14 def plot_vertexnumbering(md,options,fig,ax):
    15     '''
     11def plot_vertexnumbering(md,options,fig,axgrid,gridindex):
     12        '''
    1613        PLOT_VERTEXNUMBERING - plot vertex numbering
    17 
    18         Usage:
    19         plot_vertexnumbering(md,options,fig,axes);
    20 
     14       
     15        Usage:
     16        plot_vertexnumbering(md,options,fig,axes);
     17       
    2118        See also: PLOTMODEL
    22 
     19       
    2320        '''
    2421        #process data and model
    25     x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
    26     XLims=[np.min(x),np.max(x)]
    27     YLims=[np.min(y),np.max(y)]
    28     #plot mesh
    29     ax.triplot(x,y,elements)
    30     highlightpos=options.getfieldvalue('highlight','none')
    31     if highlightpos!='none':
    32         #if just one element duplicate it to avoid coloring issues
    33         if type(highlightpos)==int:
    34             highlightpos=[highlightpos,highlightpos]
    35         #convert from to matlab numbering
    36         highlightpos=[pos-1 for pos in highlightpos]
    37         colors=np.asarray([0.5 for element in elements[highlightpos]])
    38         ax.tripcolor(x,y,vertices[highlightpos],facecolors=colors,alpha=0.5)
    39     # and numbers
     22        x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
     23
     24        ax=axgrid[gridindex]
     25        fig.delaxes(axgrid.cbar_axes[gridindex])
    4026       
    41     for i,element in enumerate(elements):
    42         for j in [0,1,2]:
    43             ax.text(x[element][j],y[element][j],str(element[j]))       
     27        if is2d:
     28                ax.triplot(x,y,elements)
     29        else:
     30                ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)
     31
     32
     33        XLims=[np.min(x),np.max(x)]
     34        YLims=[np.min(y),np.max(y)]
     35        #plot mesh
     36        ax.triplot(x,y,elements)
     37        highlightpos=options.getfieldvalue('highlight','none')
     38        if highlightpos!='none':
     39                #if just one element duplicate it to avoid coloring issues
     40                if type(highlightpos)==int:
     41                        highlightpos=[highlightpos,highlightpos]
     42                #convert from to matlab numbering
     43                highlightpos=[pos-1 for pos in highlightpos]
     44                colors=np.asarray([0.5 for element in elements[highlightpos]])
     45                ax.tripcolor(x,y,vertices[highlightpos],facecolors=colors,alpha=0.5)
     46        # and numbers
     47        for i,Xcoord in enumerate(x):
     48                ax.text(x[i],y[i],str(i+1))     
    4449       
    45     #apply options
    46     options.addfielddefault('title','Vertex numbers')
    47     options.addfielddefault('colorbar','off')
    48     applyoptions(md,[],options,fig,ax)
     50        #apply options
     51        options.addfielddefault('title','Vertex numbers (matlab indexation)')
     52        options.addfielddefault('colorbar','off')
     53        applyoptions(md,[],options,fig,axgrid,gridindex)
  • ../trunk-jpl/src/m/plot/plot_manager.py

     
    6666                        #fig.delaxes(fig.axes[1]) # hack to remove colorbar after the fact
    6767                        return
    6868                elif data=='BC':
    69                         plot_BC(md,options,fig,ax)
     69                        plot_BC(md,options,fig,axgrid,gridindex)
    7070                        return
    7171                elif data=='elementnumbering':
    72                         plot_elementnumbering(md,options,fig,ax)
     72                        plot_elementnumbering(md,options,fig,axgrid,gridindex)
    7373                        return
    7474                elif data=='vertexnumbering':
    75                         plot_vertexnumbering(md,options,fig,ax)
     75                        plot_vertexnumbering(md,options,fig,axgrid,gridindex)
    7676                        return
    7777                elif data=='none':
    7878                        print 'no data provided to plot (TODO: write plot_none.py)'
    79                         applyoptions(md,[],options,fig,ax)
     79                        applyoptions(md,[],options,fig,axgrid,gridindex)
    8080                        return
    8181                else:
    8282                        print "WARNING: '%s' is not implemented or is not a valid string for option 'data'" % data
Note: See TracBrowser for help on using the repository browser.