source:
issm/oecreview/Archive/21337-21723/ISSM-21474-21475.diff@
21726
Last change on this file since 21726 was 21726, checked in by , 8 years ago | |
---|---|
File size: 5.8 KB |
-
../trunk-jpl/src/m/plot/plot_mesh.py
26 26 27 27 if is2d: 28 28 ax.triplot(x,y,elements) 29 30 29 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')34 30 ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D) 35 31 36 32 -
../trunk-jpl/src/m/plot/plot_elementnumbering.py
8 8 from applyoptions import applyoptions 9 9 from plot_icefront import plot_icefront 10 10 11 def plot_elementnumbering(md,options,fig,ax ):11 def plot_elementnumbering(md,options,fig,axgrid,gridindex): 12 12 ''' 13 13 plot_elementnumbering - plot element numberign (starting at 1 matlab and c convention) 14 14 … … 17 17 18 18 See also: PLOTMODEL 19 19 ''' 20 x,y,z,elements,is2d,isplanet=processmesh(md,[],options) 21 22 ax=axgrid[gridindex] 23 fig.delaxes(axgrid.cbar_axes[gridindex]) 20 24 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 22 30 XLims=[np.min(x),np.max(x)] 23 31 YLims=[np.min(y),np.max(y)] 24 32 #plot mesh … … 36 44 for i,element in enumerate(elements): 37 45 ax.text(np.mean(x[element]),np.mean(y[element]),str(i+1),ha='center',va='center') 38 46 39 40 47 #apply options 41 options.addfielddefault('title','Element numbers ')48 options.addfielddefault('title','Element numbers (matlab indexation)') 42 49 options.addfielddefault('colorbar','off') 43 applyoptions(md,[],options,fig,ax )50 applyoptions(md,[],options,fig,axgrid,gridindex) 44 51 -
../trunk-jpl/src/m/plot/plot_vertexnumbering.py
1 2 3 4 1 try: 5 2 import pylab as p 6 3 except ImportError: … … 11 8 from applyoptions import applyoptions 12 9 from plot_icefront import plot_icefront 13 10 14 def plot_vertexnumbering(md,options,fig,ax ):15 11 def plot_vertexnumbering(md,options,fig,axgrid,gridindex): 12 ''' 16 13 PLOT_VERTEXNUMBERING - plot vertex numbering 17 18 19 20 14 15 Usage: 16 plot_vertexnumbering(md,options,fig,axes); 17 21 18 See also: PLOTMODEL 22 19 23 20 ''' 24 21 #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]) 40 26 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)) 44 49 45 46 options.addfielddefault('title','Vertex numbers')47 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
66 66 #fig.delaxes(fig.axes[1]) # hack to remove colorbar after the fact 67 67 return 68 68 elif data=='BC': 69 plot_BC(md,options,fig,ax )69 plot_BC(md,options,fig,axgrid,gridindex) 70 70 return 71 71 elif data=='elementnumbering': 72 plot_elementnumbering(md,options,fig,ax )72 plot_elementnumbering(md,options,fig,axgrid,gridindex) 73 73 return 74 74 elif data=='vertexnumbering': 75 plot_vertexnumbering(md,options,fig,ax )75 plot_vertexnumbering(md,options,fig,axgrid,gridindex) 76 76 return 77 77 elif data=='none': 78 78 print 'no data provided to plot (TODO: write plot_none.py)' 79 applyoptions(md,[],options,fig,ax )79 applyoptions(md,[],options,fig,axgrid,gridindex) 80 80 return 81 81 else: 82 82 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.