def plot(self): """ Plots the mesh using matplotlib. Example: >>> m = Mesh([[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0],],[[1,0,2],[2,0,3],],[[2,0,1],[2,0,1],[2,0,1],[2,0,1],],[]) >>> m.plot() # plots the mesh """ import triangulation triangulation.plot_tria_mesh(self._nodes, self._elements)
def plot(self, filename="a.png"): """ Plots the mesh using matplotlib. Example: >>> m = Mesh([[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0],],[[1,0,2],[2,0,3],],[[3,2,1],[2,1,2],[1,0,3],[0,3,4],],[]) >>> m.plot() # plots the mesh """ import triangulation triangulation.plot_tria_mesh(self._nodes, self._elements, filename=filename)
def plot(self, filename="a.png", method="nice", lab=True): """ Plots the mesh using matplotlib. Example: >>> m = Mesh([[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0],],[[1,0,2],[2,0,3],],[[3,2,1],[2,1,2],[1,0,3],[0,3,4],],[]) >>> m.plot() # plots the mesh """ if method == "simple": f = triangulation.plot_tria_mesh(self._nodes, self._elements, filename=filename, save=not lab) if lab: return_mpl_figure(f) else: f.savefig(filename, format='png', dpi=80) elif method == "nice": polygons, orders = self.to_polygons_orders() f = plot_mesh_mpl(polygons, orders) if lab: return_mpl_figure(f) else: f.savefig(filename, format='png', dpi=80) else: raise ValueError("Unknown method")