[21726] | 1 | Index: ../trunk-jpl/src/m/plot/plot_mesh.py
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/plot/plot_mesh.py (revision 21474)
|
---|
| 4 | +++ ../trunk-jpl/src/m/plot/plot_mesh.py (revision 21475)
|
---|
| 5 | @@ -26,11 +26,7 @@
|
---|
| 6 |
|
---|
| 7 | if is2d:
|
---|
| 8 | ax.triplot(x,y,elements)
|
---|
| 9 | -
|
---|
| 10 | else:
|
---|
| 11 | - # fig.delaxes(ax)
|
---|
| 12 | - # geom=int(str(axgrid.get_geometry()[0])+str(axgrid.get_geometry()[1])+str(gridindex+1))
|
---|
| 13 | - # ax = fig.add_subplot(geom,projection='3d')
|
---|
| 14 | ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 | Index: ../trunk-jpl/src/m/plot/plot_elementnumbering.py
|
---|
| 18 | ===================================================================
|
---|
| 19 | --- ../trunk-jpl/src/m/plot/plot_elementnumbering.py (revision 21474)
|
---|
| 20 | +++ ../trunk-jpl/src/m/plot/plot_elementnumbering.py (revision 21475)
|
---|
| 21 | @@ -8,7 +8,7 @@
|
---|
| 22 | from applyoptions import applyoptions
|
---|
| 23 | from plot_icefront import plot_icefront
|
---|
| 24 |
|
---|
| 25 | -def plot_elementnumbering(md,options,fig,ax):
|
---|
| 26 | +def plot_elementnumbering(md,options,fig,axgrid,gridindex):
|
---|
| 27 | '''
|
---|
| 28 | plot_elementnumbering - plot element numberign (starting at 1 matlab and c convention)
|
---|
| 29 |
|
---|
| 30 | @@ -17,8 +17,16 @@
|
---|
| 31 |
|
---|
| 32 | See also: PLOTMODEL
|
---|
| 33 | '''
|
---|
| 34 | + x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
|
---|
| 35 | +
|
---|
| 36 | + ax=axgrid[gridindex]
|
---|
| 37 | + fig.delaxes(axgrid.cbar_axes[gridindex])
|
---|
| 38 |
|
---|
| 39 | - x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
|
---|
| 40 | + if is2d:
|
---|
| 41 | + ax.triplot(x,y,elements)
|
---|
| 42 | + else:
|
---|
| 43 | + ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)
|
---|
| 44 | +
|
---|
| 45 | XLims=[np.min(x),np.max(x)]
|
---|
| 46 | YLims=[np.min(y),np.max(y)]
|
---|
| 47 | #plot mesh
|
---|
| 48 | @@ -36,9 +44,8 @@
|
---|
| 49 | for i,element in enumerate(elements):
|
---|
| 50 | ax.text(np.mean(x[element]),np.mean(y[element]),str(i+1),ha='center',va='center')
|
---|
| 51 |
|
---|
| 52 | -
|
---|
| 53 | #apply options
|
---|
| 54 | - options.addfielddefault('title','Element numbers')
|
---|
| 55 | + options.addfielddefault('title','Element numbers (matlab indexation)')
|
---|
| 56 | options.addfielddefault('colorbar','off')
|
---|
| 57 | - applyoptions(md,[],options,fig,ax)
|
---|
| 58 | + applyoptions(md,[],options,fig,axgrid,gridindex)
|
---|
| 59 |
|
---|
| 60 | Index: ../trunk-jpl/src/m/plot/plot_vertexnumbering.py
|
---|
| 61 | ===================================================================
|
---|
| 62 | --- ../trunk-jpl/src/m/plot/plot_vertexnumbering.py (revision 21474)
|
---|
| 63 | +++ ../trunk-jpl/src/m/plot/plot_vertexnumbering.py (revision 21475)
|
---|
| 64 | @@ -1,6 +1,3 @@
|
---|
| 65 | -
|
---|
| 66 | -
|
---|
| 67 | -
|
---|
| 68 | try:
|
---|
| 69 | import pylab as p
|
---|
| 70 | except ImportError:
|
---|
| 71 | @@ -11,38 +8,46 @@
|
---|
| 72 | from applyoptions import applyoptions
|
---|
| 73 | from plot_icefront import plot_icefront
|
---|
| 74 |
|
---|
| 75 | -def plot_vertexnumbering(md,options,fig,ax):
|
---|
| 76 | - '''
|
---|
| 77 | +def plot_vertexnumbering(md,options,fig,axgrid,gridindex):
|
---|
| 78 | + '''
|
---|
| 79 | PLOT_VERTEXNUMBERING - plot vertex numbering
|
---|
| 80 | -
|
---|
| 81 | - Usage:
|
---|
| 82 | - plot_vertexnumbering(md,options,fig,axes);
|
---|
| 83 | -
|
---|
| 84 | +
|
---|
| 85 | + Usage:
|
---|
| 86 | + plot_vertexnumbering(md,options,fig,axes);
|
---|
| 87 | +
|
---|
| 88 | See also: PLOTMODEL
|
---|
| 89 | -
|
---|
| 90 | +
|
---|
| 91 | '''
|
---|
| 92 | #process data and model
|
---|
| 93 | - x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
|
---|
| 94 | - XLims=[np.min(x),np.max(x)]
|
---|
| 95 | - YLims=[np.min(y),np.max(y)]
|
---|
| 96 | - #plot mesh
|
---|
| 97 | - ax.triplot(x,y,elements)
|
---|
| 98 | - highlightpos=options.getfieldvalue('highlight','none')
|
---|
| 99 | - if highlightpos!='none':
|
---|
| 100 | - #if just one element duplicate it to avoid coloring issues
|
---|
| 101 | - if type(highlightpos)==int:
|
---|
| 102 | - highlightpos=[highlightpos,highlightpos]
|
---|
| 103 | - #convert from to matlab numbering
|
---|
| 104 | - highlightpos=[pos-1 for pos in highlightpos]
|
---|
| 105 | - colors=np.asarray([0.5 for element in elements[highlightpos]])
|
---|
| 106 | - ax.tripcolor(x,y,vertices[highlightpos],facecolors=colors,alpha=0.5)
|
---|
| 107 | - # and numbers
|
---|
| 108 | + x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
|
---|
| 109 | +
|
---|
| 110 | + ax=axgrid[gridindex]
|
---|
| 111 | + fig.delaxes(axgrid.cbar_axes[gridindex])
|
---|
| 112 |
|
---|
| 113 | - for i,element in enumerate(elements):
|
---|
| 114 | - for j in [0,1,2]:
|
---|
| 115 | - ax.text(x[element][j],y[element][j],str(element[j]))
|
---|
| 116 | + if is2d:
|
---|
| 117 | + ax.triplot(x,y,elements)
|
---|
| 118 | + else:
|
---|
| 119 | + ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)
|
---|
| 120 | +
|
---|
| 121 | +
|
---|
| 122 | + XLims=[np.min(x),np.max(x)]
|
---|
| 123 | + YLims=[np.min(y),np.max(y)]
|
---|
| 124 | + #plot mesh
|
---|
| 125 | + ax.triplot(x,y,elements)
|
---|
| 126 | + highlightpos=options.getfieldvalue('highlight','none')
|
---|
| 127 | + if highlightpos!='none':
|
---|
| 128 | + #if just one element duplicate it to avoid coloring issues
|
---|
| 129 | + if type(highlightpos)==int:
|
---|
| 130 | + highlightpos=[highlightpos,highlightpos]
|
---|
| 131 | + #convert from to matlab numbering
|
---|
| 132 | + highlightpos=[pos-1 for pos in highlightpos]
|
---|
| 133 | + colors=np.asarray([0.5 for element in elements[highlightpos]])
|
---|
| 134 | + ax.tripcolor(x,y,vertices[highlightpos],facecolors=colors,alpha=0.5)
|
---|
| 135 | + # and numbers
|
---|
| 136 | + for i,Xcoord in enumerate(x):
|
---|
| 137 | + ax.text(x[i],y[i],str(i+1))
|
---|
| 138 |
|
---|
| 139 | - #apply options
|
---|
| 140 | - options.addfielddefault('title','Vertex numbers')
|
---|
| 141 | - options.addfielddefault('colorbar','off')
|
---|
| 142 | - applyoptions(md,[],options,fig,ax)
|
---|
| 143 | + #apply options
|
---|
| 144 | + options.addfielddefault('title','Vertex numbers (matlab indexation)')
|
---|
| 145 | + options.addfielddefault('colorbar','off')
|
---|
| 146 | + applyoptions(md,[],options,fig,axgrid,gridindex)
|
---|
| 147 | Index: ../trunk-jpl/src/m/plot/plot_manager.py
|
---|
| 148 | ===================================================================
|
---|
| 149 | --- ../trunk-jpl/src/m/plot/plot_manager.py (revision 21474)
|
---|
| 150 | +++ ../trunk-jpl/src/m/plot/plot_manager.py (revision 21475)
|
---|
| 151 | @@ -66,17 +66,17 @@
|
---|
| 152 | #fig.delaxes(fig.axes[1]) # hack to remove colorbar after the fact
|
---|
| 153 | return
|
---|
| 154 | elif data=='BC':
|
---|
| 155 | - plot_BC(md,options,fig,ax)
|
---|
| 156 | + plot_BC(md,options,fig,axgrid,gridindex)
|
---|
| 157 | return
|
---|
| 158 | elif data=='elementnumbering':
|
---|
| 159 | - plot_elementnumbering(md,options,fig,ax)
|
---|
| 160 | + plot_elementnumbering(md,options,fig,axgrid,gridindex)
|
---|
| 161 | return
|
---|
| 162 | elif data=='vertexnumbering':
|
---|
| 163 | - plot_vertexnumbering(md,options,fig,ax)
|
---|
| 164 | + plot_vertexnumbering(md,options,fig,axgrid,gridindex)
|
---|
| 165 | return
|
---|
| 166 | elif data=='none':
|
---|
| 167 | print 'no data provided to plot (TODO: write plot_none.py)'
|
---|
| 168 | - applyoptions(md,[],options,fig,ax)
|
---|
| 169 | + applyoptions(md,[],options,fig,axgrid,gridindex)
|
---|
| 170 | return
|
---|
| 171 | else:
|
---|
| 172 | print "WARNING: '%s' is not implemented or is not a valid string for option 'data'" % data
|
---|