Changeset 21478


Ignore:
Timestamp:
01/11/17 01:22:30 (8 years ago)
Author:
bdef
Message:

CHG:prettyfying numbering plots

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  
    2626                ax.triplot(x,y,elements)
    2727        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'
    2929
    3030        XLims=[np.min(x),np.max(x)]
     
    4343        # and numbers
    4444        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)
    4646               
    4747        #apply options
  • issm/trunk-jpl/src/m/plot/plot_vertexnumbering.py

    r21475 r21478  
    2828                ax.triplot(x,y,elements)
    2929        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'
    3131
    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))
    3534        #plot mesh
    3635        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',[])
    3840        if highlightpos!='none':
    3941                #if just one element duplicate it to avoid coloring issues
     
    4244                #convert from to matlab numbering
    4345                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
    4647        # and numbers
    4748        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               
    5055        #apply options
    5156        options.addfielddefault('title','Vertex numbers (matlab indexation)')
Note: See TracChangeset for help on using the changeset viewer.