Index: ../trunk-jpl/src/m/plot/plot_mesh.py =================================================================== --- ../trunk-jpl/src/m/plot/plot_mesh.py (revision 21474) +++ ../trunk-jpl/src/m/plot/plot_mesh.py (revision 21475) @@ -26,11 +26,7 @@ if is2d: ax.triplot(x,y,elements) - else: - # fig.delaxes(ax) - # geom=int(str(axgrid.get_geometry()[0])+str(axgrid.get_geometry()[1])+str(gridindex+1)) - # ax = fig.add_subplot(geom,projection='3d') ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D) Index: ../trunk-jpl/src/m/plot/plot_elementnumbering.py =================================================================== --- ../trunk-jpl/src/m/plot/plot_elementnumbering.py (revision 21474) +++ ../trunk-jpl/src/m/plot/plot_elementnumbering.py (revision 21475) @@ -8,7 +8,7 @@ from applyoptions import applyoptions from plot_icefront import plot_icefront -def plot_elementnumbering(md,options,fig,ax): +def plot_elementnumbering(md,options,fig,axgrid,gridindex): ''' plot_elementnumbering - plot element numberign (starting at 1 matlab and c convention) @@ -17,8 +17,16 @@ See also: PLOTMODEL ''' + x,y,z,elements,is2d,isplanet=processmesh(md,[],options) + + ax=axgrid[gridindex] + fig.delaxes(axgrid.cbar_axes[gridindex]) - x,y,z,elements,is2d,isplanet=processmesh(md,[],options) + if is2d: + ax.triplot(x,y,elements) + else: + ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D) + XLims=[np.min(x),np.max(x)] YLims=[np.min(y),np.max(y)] #plot mesh @@ -36,9 +44,8 @@ for i,element in enumerate(elements): ax.text(np.mean(x[element]),np.mean(y[element]),str(i+1),ha='center',va='center') - #apply options - options.addfielddefault('title','Element numbers') + options.addfielddefault('title','Element numbers (matlab indexation)') options.addfielddefault('colorbar','off') - applyoptions(md,[],options,fig,ax) + applyoptions(md,[],options,fig,axgrid,gridindex) Index: ../trunk-jpl/src/m/plot/plot_vertexnumbering.py =================================================================== --- ../trunk-jpl/src/m/plot/plot_vertexnumbering.py (revision 21474) +++ ../trunk-jpl/src/m/plot/plot_vertexnumbering.py (revision 21475) @@ -1,6 +1,3 @@ - - - try: import pylab as p except ImportError: @@ -11,38 +8,46 @@ from applyoptions import applyoptions from plot_icefront import plot_icefront -def plot_vertexnumbering(md,options,fig,ax): - ''' +def plot_vertexnumbering(md,options,fig,axgrid,gridindex): + ''' PLOT_VERTEXNUMBERING - plot vertex numbering - - Usage: - plot_vertexnumbering(md,options,fig,axes); - + + Usage: + plot_vertexnumbering(md,options,fig,axes); + See also: PLOTMODEL - + ''' #process data and model - x,y,z,elements,is2d,isplanet=processmesh(md,[],options) - XLims=[np.min(x),np.max(x)] - YLims=[np.min(y),np.max(y)] - #plot mesh - ax.triplot(x,y,elements) - highlightpos=options.getfieldvalue('highlight','none') - if highlightpos!='none': - #if just one element duplicate it to avoid coloring issues - if type(highlightpos)==int: - highlightpos=[highlightpos,highlightpos] - #convert from to matlab numbering - highlightpos=[pos-1 for pos in highlightpos] - colors=np.asarray([0.5 for element in elements[highlightpos]]) - ax.tripcolor(x,y,vertices[highlightpos],facecolors=colors,alpha=0.5) - # and numbers + x,y,z,elements,is2d,isplanet=processmesh(md,[],options) + + ax=axgrid[gridindex] + fig.delaxes(axgrid.cbar_axes[gridindex]) - for i,element in enumerate(elements): - for j in [0,1,2]: - ax.text(x[element][j],y[element][j],str(element[j])) + if is2d: + ax.triplot(x,y,elements) + else: + ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D) + + + XLims=[np.min(x),np.max(x)] + YLims=[np.min(y),np.max(y)] + #plot mesh + ax.triplot(x,y,elements) + highlightpos=options.getfieldvalue('highlight','none') + if highlightpos!='none': + #if just one element duplicate it to avoid coloring issues + if type(highlightpos)==int: + highlightpos=[highlightpos,highlightpos] + #convert from to matlab numbering + highlightpos=[pos-1 for pos in highlightpos] + colors=np.asarray([0.5 for element in elements[highlightpos]]) + ax.tripcolor(x,y,vertices[highlightpos],facecolors=colors,alpha=0.5) + # and numbers + for i,Xcoord in enumerate(x): + ax.text(x[i],y[i],str(i+1)) - #apply options - options.addfielddefault('title','Vertex numbers') - options.addfielddefault('colorbar','off') - applyoptions(md,[],options,fig,ax) + #apply options + options.addfielddefault('title','Vertex numbers (matlab indexation)') + options.addfielddefault('colorbar','off') + applyoptions(md,[],options,fig,axgrid,gridindex) Index: ../trunk-jpl/src/m/plot/plot_manager.py =================================================================== --- ../trunk-jpl/src/m/plot/plot_manager.py (revision 21474) +++ ../trunk-jpl/src/m/plot/plot_manager.py (revision 21475) @@ -66,17 +66,17 @@ #fig.delaxes(fig.axes[1]) # hack to remove colorbar after the fact return elif data=='BC': - plot_BC(md,options,fig,ax) + plot_BC(md,options,fig,axgrid,gridindex) return elif data=='elementnumbering': - plot_elementnumbering(md,options,fig,ax) + plot_elementnumbering(md,options,fig,axgrid,gridindex) return elif data=='vertexnumbering': - plot_vertexnumbering(md,options,fig,ax) + plot_vertexnumbering(md,options,fig,axgrid,gridindex) return elif data=='none': print 'no data provided to plot (TODO: write plot_none.py)' - applyoptions(md,[],options,fig,ax) + applyoptions(md,[],options,fig,axgrid,gridindex) return else: print "WARNING: '%s' is not implemented or is not a valid string for option 'data'" % data