Plotting¶
vertax.meshes.plot
Plotting module for meshes.
FacePlot ¶
Bases: Enum
What it is possible to show on a face.
FACE_PARAMETER
class-attribute
instance-attribute
¶
FACE_PARAMETER = 2
The face color depends on its parameter.
PERIMETER
class-attribute
instance-attribute
¶
PERIMETER = 4
The face color depends on its perimeter.
FATES
class-attribute
instance-attribute
¶
FATES = 6
Faces are colored depending on their fate marker (if any).
EdgePlot ¶
Bases: Enum
What it is possible to show on an edge.
EDGE_PARAMETER
class-attribute
instance-attribute
¶
EDGE_PARAMETER = 2
The edge color depends on its parameter.
VertexPlot ¶
Bases: Enum
What it is possible to show on a vertex.
add_colorbar ¶
add_colorbar(fig: Figure, ax: Axes, v_min: float, v_max: float, cmap: Colormap) -> Colorbar
Add a colorbar to the figure, with given min and max values and colormap.
adjust_lightness ¶
adjust_lightness(color: tuple[float, float, float], amount: float = 0.5) -> tuple[float, float, float]
Adjust lightness of a color.
get_cmap ¶
get_cmap(n: int, name: str = 'hsv') -> Callable[[int], tuple[float, float, float, float]]
Returns a function that maps each index in 0, 1, ..., n-1 to a distinct RGB color.
The keyword argument name must be a standard mpl colormap name.
save_simple_xy_graph ¶
save_simple_xy_graph(filename: str, x_data: list[float], y_data: list[float], title: str = '', x_label: str = '', y_label: str = '') -> None
Save a simple line plot.
plot_mesh ¶
plot_mesh(mesh: Mesh, vertex_plot: VertexPlot = VertexPlot.INVISIBLE, edge_plot: EdgePlot = EdgePlot.BLACK, face_plot: FacePlot = FacePlot.MULTICOLOR, vertex_parameters_name: str = '', edge_parameters_name: str = '', face_parameters_name: str = '', show: bool = False, save: bool = False, save_path: str = 'pbc_mesh.png', faces_cmap_name: str = 'cividis', edges_cmap_name: str = 'coolwarm', edges_width: float = 2, vertices_cmap_name: str = 'spring', vertices_size: float = 20, title: str = '', forced_vertex_scale: tuple[float, float] | None = None, forced_edge_scale: tuple[float, float] | None = None, forced_face_scale: tuple[float, float] | None = None) -> None
Plot the mesh, and return the figure and axes so the caller can save or compose.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
show
|
bool
|
display the figure. Defaults to False. A library function that blocks by default
is a defect: under an interactive backend |
False
|
Returns:
| Type | Description |
|---|---|
None
|
|
get_plot_mesh ¶
get_plot_mesh(mesh: Mesh, vertex_plot: VertexPlot = VertexPlot.INVISIBLE, edge_plot: EdgePlot = EdgePlot.BLACK, face_plot: FacePlot = FacePlot.MULTICOLOR, vertex_parameters_name: str = '', edge_parameters_name: str = '', face_parameters_name: str = '', faces_cmap_name: str = 'cividis', edges_cmap_name: str = 'coolwarm', edges_width: float = 2, vertices_cmap_name: str = 'spring', vertices_size: float = 20, title: str = '', forced_vertex_scale: tuple[float, float] | None = None, forced_edge_scale: tuple[float, float] | None = None, forced_face_scale: tuple[float, float] | None = None) -> tuple[Figure, Axes]
Get the matplotlib figure and and ax for one plot.