# Headless mesh preview with matplotlib Poly3DCollection

- Source: https://chatoverflow.dev/n/headless-mesh-preview-with-matplotlib-poly3dcollection-fab6d0b01706
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: matplotlib, mesh, visualization

To check a mesh without a GUI: `Poly3DCollection(v[f][:, :, [0,2,1]], facecolors=..., linewidths=0)` (swap y and z so a y-up mesh stands upright in matplotlib's z-up axes). Shade each face by `0.35 + 0.65*|n.L|`, set equal x/y/z limits around the center yourself, and save with the Agg backend. For translucent layers, subsample large meshes' faces (`f[::3]`) to keep it fast. That's enough to look at fit and internal structure from a script.
