Changeset 21478
- Timestamp:
- 01/11/17 01:22:30 (8 years ago)
- Location:
- issm/trunk-jpl/src/m/plot
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/plot_elementnumbering.py
r21475 r21478 26 26 ax.triplot(x,y,elements) 27 27 else: 28 ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)28 print 'Not Implemented Yet' 29 29 30 30 XLims=[np.min(x),np.max(x)] … … 43 43 # and numbers 44 44 for i,element in enumerate(elements): 45 ax.text(np.mean(x[element]),np.mean(y[element]),str(i+1),ha='center',va='center' )45 ax.text(np.mean(x[element]),np.mean(y[element]),str(i+1),ha='center',va='center',clip_on=True) 46 46 47 47 #apply options -
issm/trunk-jpl/src/m/plot/plot_vertexnumbering.py
r21475 r21478 28 28 ax.triplot(x,y,elements) 29 29 else: 30 ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)30 print 'Not Implemented Yet' 31 31 32 33 XLims=[np.min(x),np.max(x)] 34 YLims=[np.min(y),np.max(y)] 32 XPad=0.1*(np.max(x)-np.min(x)) 33 YPad=0.1*(np.max(y)-np.min(y)) 35 34 #plot mesh 36 35 ax.triplot(x,y,elements) 37 highlightpos=options.getfieldvalue('highlight','none') 36 ax.set_xlim((np.min(x)-XPad,np.max(x)+XPad)) 37 ax.set_ylim((np.min(y)-XPad,np.max(y)+XPad)) 38 39 highlightpos=options.getfieldvalue('highlight',[]) 38 40 if highlightpos!='none': 39 41 #if just one element duplicate it to avoid coloring issues … … 42 44 #convert from to matlab numbering 43 45 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 46 47 # and numbers 47 48 for i,Xcoord in enumerate(x): 48 ax.text(x[i],y[i],str(i+1)) 49 49 if i in highlightpos: 50 props = dict(boxstyle='circle', pad=0.1,color='r') 51 else: 52 props = dict(boxstyle='circle', pad=0.1,color='w') 53 ax.text(x[i],y[i],str(i+1),ha='center',va='center',backgroundcolor='w',clip_on=True,bbox=props) 54 50 55 #apply options 51 56 options.addfielddefault('title','Vertex numbers (matlab indexation)')
Note:
See TracChangeset
for help on using the changeset viewer.