Plotting FacetFunctions in matplotlib not implemented
Issue #951
new
As vtk is deprecated, there are no way of visiualizing FacetFunction in directly in dolfin.
Comments (3)
-
-
reporter I have a similar setup, that @minrk created today.
import dolfin import matplotlib.pyplot as plt def facet_plot2d(facet_func,mesh, mesh_edges=True, markers=None): x_list, y_list = [],[] if markers == None: for facet in dolfin.facets(mesh): mp = facet.midpoint() x_list.append(mp.x()) y_list.append(mp.y()) new_facet_func = facet_func.array() else: i = 0 new_facet_func = [] for facet in dolfin.facets(mesh): if facet_func[i] in markers: mp = facet.midpoint() x_list.append(mp.x()) y_list.append(mp.y()) new_facet_func.append(facet_func[i]) i+=1 if mesh_edges: dolfin.plot(facet_func.mesh()) plt.scatter(x_list, y_list, s=30, c=new_facet_func, linewidths=1)
This snippet creates markers at midpoints of edges. I am not satisfied with this solution, as it is impossible to see these circles on fine meshes. I really liked the way they were visualized in VTK, as they could create an interface. My temporary solution was to include code that excludes all markers that are not specified by the user.
-
reporter @mikael_mortensen @mirok, maybe a FacetFunction visualization is something that could be included in FEniCS-tools (I guess Tormod's variant is the one that this should be based on).
- Log in to comment
See pull request #411