def draw_points(self, points): """Draws points on a 2D plot. Parameters ---------- points : list of dict List of dictionaries containing the point properties. Each point is represented by a circle with a given radius. The following properties of the circle can be specified in the point dict. * pos (list): XY(Z) coordinates * radius (float, optional): the radius of the circle. Default is 0.1. * text (str, optional): the text of the label. Default is None. * facecolor (rgb or hex color, optional): The color of the face of the circle. Default is white. * edgecolor (rgb or hex color, optional): The color of the edge of the cicrle. Default is black. * edgewidth (float, optional): The width of the edge of the circle. Default is 1.0. * textcolor (rgb or hex color, optional): Color of the text label. Default is black. * fontsize (int, optional): Font size of the text label. Default is 12. Returns ------- object The matplotlib point collection object. """ return draw_xpoints_xy(points, self.axes)
def draw(self): # add faces polygons = [] for key in self.mesh.faces(): polygons.append({ 'points': self.mesh.face_coordinates(key), 'facecolor': '#eeeeee', 'edgecolor': '#cccccc' }) collection = draw_xpolygons_xy(polygons, self.plotter.axes) self._mpl_facecollection = collection # add vertices points = [] for key in self.mesh.vertices(): points.append({ 'pos': self.mesh.vertex_attributes(key, 'xy'), 'radius': 0.1, 'text': None, 'facecolor': '#ffffff', 'edgecolor': '#000000', 'edgewidth': 0.5, 'textcolor': '#000000', 'fontsize': 6 }) collection = draw_xpoints_xy(points, self.plotter.axes) self._mpl_vertexcollection = collection # add edges lines = [] for key in self.mesh.edges(): u, v = key lines.append({ 'start': self.mesh.vertex_attributes(u, 'xy'), 'end': self.mesh.vertex_attributes(v, 'xy'), 'width': 1.0, 'color': (255, 0, 0) }) collection = draw_xlines_xy(lines, self.plotter.axes) self._mpl_edgecollection = collection