Skip to content

Infer export height from explicit layout bands - #44

Merged
marco-mariotti merged 18 commits into
pyranges:mainfrom
ginitheclaw:prototype/auto-size-mpl
May 31, 2026
Merged

Infer export height from explicit layout bands#44
marco-mariotti merged 18 commits into
pyranges:mainfrom
ginitheclaw:prototype/auto-size-mpl

Conversation

@ginitheclaw

Copy link
Copy Markdown
Contributor

Summary

  • make default file/returned figure sizing infer height from vertical layout while keeping width fixed
  • reserve explicit Matplotlib bands for panel titles, x axes, inter-panel gaps, and bottom legends
  • avoid reserving above/below label padding for tracks without displayed fitted labels
  • add Track.plot convenience method and auto-height regression coverage

Validation

  • .venv/bin/python -m pytest -q tests/test_auto_height.py tests/test_track.py tests/test_ply.py

@marco-mariotti

Copy link
Copy Markdown
Member

Many * .rtd. * images show panel titles with unacceptable overlapping.
And prp_rtd_27.png‎ image looks nothing like the baseline: missing the rest of dashboard.

bump v if needed.
add comment in plot docstring re outline_col: use outline_color for uniform color (or something like that).

colormap: it should be default value: None, which falls back to global option.

label: direct user to print_options() for additional options affecting label.

@ginitheclaw

Copy link
Copy Markdown
Contributor Author

Addressed review comments in 052f70f. Summary:

  • Updated plot docstring wording for limits, reverse, shrink, label, outline_col, label_color_col, colormap, panel_title, tooltip, return_plot, and max_shown.
  • Kept tuple selectors rejected for reverse; test coverage is present for that ValueError.
  • Confirmed tooltip support is not Plotly-only: Matplotlib uses hover annotations via motion_notify_event, and Plotly uses trace hover text.
  • Increased Matplotlib title/x-axis spacing, regenerated RTD Matplotlib images and mpl baselines; spot-checked regenerated docs images and prp_rtd_27.
  • pydata-sphinx-theme is config/dependency-only; no docstring-specific changes needed for the theme switch.

Checks run:

  • .venv/bin/python -m pytest tests/test_reverse.py tests/test_auto_height.py -q
  • .venv/bin/python -m pytest tests/test_mpl.py --mpl -q
  • .venv/bin/python -m sphinx -b html -W --keep-going docs docs/_build/html
  • .venv/bin/python -m sphinx -M latexpdf docs docs/_build -W --keep-going (Sphinx LaTeX generation succeeds; final PDF compilation is blocked on this machine because latexmk is not installed.)

@ginitheclaw

ginitheclaw commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

Updated in 3495488 after the spacing feedback.

What I changed:

  • Reverted the broad x-axis/inter-panel spacing increase (56/40 back to 46/24).
  • Kept only a small title-pad adjustment (10 → 8) to avoid title/axis collision without introducing big blank bands.
  • Reduced the Matplotlib legend bottom reserve (140 → 80) so legend examples stay closer to the pre-PR layout.
  • Regenerated the prp_rtd_*_mpl.png images and mpl baselines.
  • Compared current renders against the fetched origin/main docs images, using the intended priorities: title/text overlap as high penalty; excess vertical whitespace as lower penalty. The current images are much closer to baseline and avoid the previous whitespace overcorrection.

Checks run:

  • .venv/bin/python -m pytest tests/test_mpl.py --mpl tests/test_reverse.py tests/test_auto_height.py -q → 49 passed
  • .venv/bin/python -m sphinx -b html -W --keep-going docs docs/_build/html → passed
  • .venv/bin/python -m sphinx -M latex docs docs/_build -W --keep-going → passed

@ginitheclaw

Copy link
Copy Markdown
Contributor Author

Updated in fc059e5.

  • Reduced the inter-panel blank band further (24 → 16) while keeping the title pad at 8; regenerated the Matplotlib RTD images and mpl baselines.
  • Restored docs/images/prp_rtd_27.png from the pre-PR baseline so the dashboard showcase panel is present again.
  • Spot-checked the regenerated image set for title/tick/axis overlaps after the reduction; no overlap problems found.

Checks run:

  • .venv/bin/python -m pytest tests/test_mpl.py --mpl tests/test_reverse.py tests/test_auto_height.py -q → 49 passed
  • .venv/bin/python -m sphinx -b html -W --keep-going docs docs/_build/html → passed
  • .venv/bin/python -m sphinx -M latex docs docs/_build -W --keep-going → passed

@marco-mariotti
marco-mariotti merged commit c147de3 into pyranges:main May 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants