for index, (x, y, z) in enumerate(cloud): points.append({ 'pos': [x, y], 'facecolor': '#000000', 'edgecolor': '#000000', 'radius': 1.0 }) points.append({ 'pos': point[0:2], 'facecolor': '#ff0000', 'edgecolor': '#ff0000', 'radius': 5.0 }) lines = [] for xyz, label, dist in nnbrs: points[label]['facecolor'] = '#00ff00' points[label]['edgecolor'] = '#00ff00' points[label]['radius'] = 3.0 lines.append({ 'start': point[0:2], 'end': xyz[0:2], 'color': '#000000', 'width': 0.1, }) plotter.draw_lines(lines) plotter.draw_points(points) plotter.show()
# create lines lines = [] for u, v in mesh.edges(): lines.append({ 'start': mesh.vertex_coordinates(u), 'end': mesh.vertex_coordinates(v), 'width': 1.0 }) # initial plotter plotter = Plotter(figsize=(10, 6)) # draw points and lines pcoll = plotter.draw_points(points) lcoll = plotter.draw_lines(lines) # a callback function that update line and point positions def callback(k, args): # update points plotter.update_pointcollection(pcoll, vertices, 0.1) segments = [] for u, v in mesh.edges(): a = vertices[u] b = vertices[v] segments.append([a, b]) # update lines plotter.update_linecollection(lcoll, segments)