Skip to content

Replace autoscaling workaround in morphology plotting with geometry-based bounds #55

@SarthakJagota

Description

@SarthakJagota

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions