def plot_mesh(pts, tri, *args): if len(args) > 0: tripcolor(pts[:,0], pts[:,1], tri, args[0], edgecolor='black', cmap="Blues") else: triplot(pts[:,0], pts[:,1], tri, "k-", lw=2) axis('tight') axes().set_aspect('equal')
def plot_mesh(pts, tri, *args): if len(args) > 0: tripcolor(pts[:, 0], pts[:, 1], tri, args[0], edgecolor="black", cmap="Blues") else: triplot(pts[:, 0], pts[:, 1], tri, "k-", lw=2) axis("tight") axes().set_aspect("equal")
def plotmesh(pts, tri, *args, **kwargs): showindex = kwargs.get('index', False) h0 = kwargs.get('h0', 0.0) edges = kwargs.get('edges', np.array([])) if len(args) > 0: tripcolor(pts[:, 0], pts[:, 1], tri, args[0], edgecolor='black', cmap="Blues") else: triplot(pts[:, 0], pts[:, 1], tri, "k-", lw=2) if showindex: dx = h0 / 10.0 for i in range(np.shape(tri)[0]): # label triangle index in green x = np.sum(pts[tri[i, :], 0]) / 3.0 y = np.sum(pts[tri[i, :], 1]) / 3.0 text(x, y, '%d' % i, color='g') for j in range(np.shape(pts)[0]): # label point index in blue text(pts[j, 0] + dx, pts[j, 1] + dx, '%d' % j, color='b') if len(edges) > 0: for k in range(np.shape(edges)[0]): # label edge index in red x = np.sum(pts[edges[k, :], 0]) / 2.0 y = np.sum(pts[edges[k, :], 1]) / 2.0 text(x + dx, y - dx, '%d' % k, color='r') axis('tight') axis('equal')
def plot_mesh(pts, tri, *args): if len(args) > 0: tripcolor(pts[:, 0], pts[:, 1], tri, args[0], edgecolor='black', cmap="Blues") else: triplot(pts[:, 0], pts[:, 1], tri, "k-", lw=2) axis('tight') axes().set_aspect('equal')
def plot_mesh(pts, tri, z=None): if z is not None: x = pts[:,0] y = pts[:,1] tripcolor(x, y, tri, z) colorbar() cs = tricontour(x, y, tri, z, colors="black", linestyles="dashed") clabel(cs) else: if len(tri[0]) == 3: plot_tri_mesh(pts, tri) else: plot_quad_mesh(pts, tri) axis('tight') xticks([]) yticks([]) axes().set_aspect('equal')
def plot_mesh(pts, tri, z=None): if z is not None: x = pts[:, 0] y = pts[:, 1] tripcolor(x, y, tri, z) colorbar() cs = tricontour(x, y, tri, z, colors="black", linestyles="dashed") clabel(cs) else: if len(tri[0]) == 3: plot_tri_mesh(pts, tri) else: plot_quad_mesh(pts, tri) axis('tight') xticks([]) yticks([]) axes().set_aspect('equal')
def plotmesh(pts, tri, *args, **kwargs): showindex = kwargs.get('index',False) h0 = kwargs.get('h0',0.0) edges = kwargs.get('edges',np.array([])) if len(args) > 0: tripcolor(pts[:,0], pts[:,1], tri, args[0], edgecolor='black', cmap="Blues") else: triplot(pts[:,0], pts[:,1], tri, "k-", lw=2) if showindex: dx = h0/10.0 for i in range(np.shape(tri)[0]): # label triangle index in green x = np.sum(pts[tri[i,:],0]) / 3.0 y = np.sum(pts[tri[i,:],1]) / 3.0 text(x,y,'%d' % i, color='g') for j in range(np.shape(pts)[0]): # label point index in blue text(pts[j,0]+dx,pts[j,1]+dx,'%d' % j, color='b') if len(edges) > 0: for k in range(np.shape(edges)[0]): # label edge index in red x = np.sum(pts[edges[k,:],0]) / 2.0 y = np.sum(pts[edges[k,:],1]) / 2.0 text(x+dx,y-dx,'%d' % k, color='r') axis('tight') axis('equal')
magfn = np.zeros((g_r.size, mag_r.size)) for i in range(g_r.size): for j in range(mag_r.size): _r = mag_r[j] _g = g_r[i] + _r magfn_sfms, magfn_pass = g.joint_optical_mag_fn_atten(hm, _g, _r, band1='g', band2='r', z=0., params=params) magfn[i,j] = magfn_sfms + magfn_pass #P.matshow(np.log10(magfn), aspect=5., # extent=[np.min(mag_r), np.max(mag_r), np.min(g_r), np.max(g_r)]) G_R, R = np.meshgrid(g_r, mag_r) matplotlib.rcParams['contour.negative_linestyle'] = 'solid' cplt1 = P.contour(G_R, R, np.log10(magfn.T), levels=[-8., -6., -4., -3., -2.], linewidths=2.5, colors='r') """ zz = np.log10(magfn_sfms.flatten()) zz[np.where(np.isinf(zz))] = -10. print np.min(zz), np.max(zz) #P.tricontourf(g_r.flatten(), mr.flatten(), zz) P.tripcolor(g_r.flatten(), mr.flatten(), zz) """ #P.colorbar() #P.tight_layout() P.show()
_r, band1='g', band2='r', z=0., params=params) magfn[i, j] = magfn_sfms + magfn_pass #P.matshow(np.log10(magfn), aspect=5., # extent=[np.min(mag_r), np.max(mag_r), np.min(g_r), np.max(g_r)]) G_R, R = np.meshgrid(g_r, mag_r) matplotlib.rcParams['contour.negative_linestyle'] = 'solid' cplt1 = P.contour(G_R, R, np.log10(magfn.T), levels=[-8., -6., -4., -3., -2.], linewidths=2.5, colors='r') """ zz = np.log10(magfn_sfms.flatten()) zz[np.where(np.isinf(zz))] = -10. print np.min(zz), np.max(zz) #P.tricontourf(g_r.flatten(), mr.flatten(), zz) P.tripcolor(g_r.flatten(), mr.flatten(), zz) """ #P.colorbar() #P.tight_layout() P.show()