mechanochat.plotting.plot_xc2grid#

mechanochat.plotting.plot_xc2grid(xc, xc2grid_map, grid_center, ax=None, show_axis=True)[source]#

Visual check of the cell-to-grid assignment produced by tl.cell2grid.

Cells are drawn as dots, grid centers in red, and a line links every cell to the center of the grid cell it was assigned to.

Parameters:
  • xc (ndarray) – (nc, 2) cell coordinates

  • xc2grid_map (dict) – Cell-to-grid mapping from tl.cell2grid

  • grid_center (dict) – Grid centers from tl.cell2grid

  • ax (Axes, optional) – Target matplotlib axes object. Creates new figure if None

  • show_axis (bool, default True) – Show axis

Returns:

ax (Axes)