pyrobopath.toolpath.visualization.colors.get_contour_colors#
- pyrobopath.toolpath.visualization.colors.get_contour_colors(contours: List[Contour], color_method='tool', color_seq='tab10')[source]#
Assigns RGBA colors to a list of contours based on a specified coloring method.
- Parameters:
contours (List[Contour]) – A list of
Contourobjects to assign colorscolor_method (str, optional) –
The method used to assign colors to contours. Options are:
"tool": Assigns a unique color to each unique tool type."cycle": Cycles through the color sequence in order."z": Assigns a unique color to each unique z-coordinate at the start of the path.
color_seq (str, optional) – The name of the Matplotlib color sequence to use. Must be a key in
matplotlib.color_sequences. Examples include"tab10","Set3","viridis", etc. See also https://matplotlib.org/gallery/color/color_sequences.html.
- Returns:
An array of shape (N, 4), where N is the number of contours. Each row is an RGBA color corresponding to a contour.
- Return type:
np.ndarray
- Raises:
ValueError – If an unknown color_method is provided.
Examples
>>> colors = get_contour_colors(contours, color_method="tool", ... color_seq="Set2")