The current 2D morphology plotting relies on invisible plot elements to force matplotlib to expand axis limits (see FIXME comments in _plot_morphology2D). This approach makes the plotting logic harder to maintain and can lead to inconsistent scaling, especially when using diameter-based rendering.
A more robust approach would compute axis bounds directly from the morphology geometry (soma radius, compartment coordinates, and polygon points when diameter rendering is enabled).
Proposed improvement:
- Collect x/y bounds during recursive plotting
- Include soma radius and diameter polygon geometry
- Apply margins explicitly via set_xlim / set_ylim
- Remove invisible plotting workaround
This would simplify the plotting logic, improve reliability, and make the code easier to extend for future visualization features.
The current 2D morphology plotting relies on invisible plot elements to force matplotlib to expand axis limits (see FIXME comments in _plot_morphology2D). This approach makes the plotting logic harder to maintain and can lead to inconsistent scaling, especially when using diameter-based rendering.
A more robust approach would compute axis bounds directly from the morphology geometry (soma radius, compartment coordinates, and polygon points when diameter rendering is enabled).
Proposed improvement:
This would simplify the plotting logic, improve reliability, and make the code easier to extend for future visualization features.