Source code for geomfum.plot
"""Plotting functions.
In this file we define the plotting logic.
Since each plotting library has its own method of plotting,
we define general functions that works with any library implemented
"""
import abc
from geomfum._registry import MeshPlotterRegistry, WhichRegistryMixins
[docs]
class ShapePlotter(abc.ABC):
"""Plotting object.
Primitive clas to plot meshes, pointclouds or specific useful informations
(scalar functions, landmarks, etc..)
"""
[docs]
@abc.abstractmethod
def add_mesh(self, mesh):
"""Add mesh to plot."""
[docs]
@abc.abstractmethod
def show(self):
"""Display plot."""
[docs]
def set_vertex_scalars(self, scalars):
"""Set vertex scalars on mesh."""
raise NotImplementedError("Not implemented for this plotter.")
[docs]
def highlight_vertices(self, coords, color, size):
"""Highlight vertices on mesh."""
raise NotImplementedError("Not implemented for this plotter.")
[docs]
class MeshPlotter(WhichRegistryMixins, ShapePlotter):
"""Plotting object to display meshes."""
_Registry = MeshPlotterRegistry