Skip to content

Allow Y axis on RHS of SVG plot #3201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025
Merged

Conversation

hyanwong
Copy link
Member

@hyanwong hyanwong commented Jun 8, 2025

This is a bit trivial, but it was the easiest way to make nice tanglegram plots for sc2ts, in which trees are rotated in different directions (see below). So I thought as I had done the work, I might as well see if it is sensible to include in tskit? Otherwise I'll just keep it on my own branch.

Note that this allows y_axis=True or y_axis="right", which is a bit yucky. No tests either, in case it seems a silly idea:

Screenshot 2025-06-08 at 18 34 50

Copy link

codecov bot commented Jun 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.63%. Comparing base (e81ee40) to head (d59218e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3201   +/-   ##
=======================================
  Coverage   89.63%   89.63%           
=======================================
  Files          28       28           
  Lines       31978    32000   +22     
  Branches     5872     5877    +5     
=======================================
+ Hits        28662    28684   +22     
  Misses       1886     1886           
  Partials     1430     1430           
Flag Coverage Δ
c-tests 86.66% <ø> (ø)
lwt-tests 80.38% <ø> (ø)
python-c-tests 88.18% <ø> (ø)
python-tests 98.86% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
python/tskit/drawing.py 98.39% <100.00%> (+0.02%) ⬆️
python/tskit/trees.py 98.88% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@benjeffery
Copy link
Member

Seems useful - if you don't like to overloaded arg then adding another arg that is y_axis_right would be possible. I'm ok with the overloaded arg in the "softer" parts of the API like this. I would change the code to only allow the strings "left" and "right" as currently a misspelling gives you odd behavior.

@hyanwong
Copy link
Member Author

hyanwong commented Jun 9, 2025

I'm happy to overload the argument, and just allow "left" and "right".

@hyanwong
Copy link
Member Author

hyanwong commented Jun 9, 2025

Should we default to having a Y axis be shown? I think there was an issue about this.

@hyanwong
Copy link
Member Author

hyanwong commented Jun 9, 2025

OK, added the tests now (hard to test the actual layout, so I added it to two existing svg mockups), e.g.

Screenshot 2025-06-09 at 06 26 57

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. minor logic tweak suggested

@hyanwong hyanwong added this pull request to the merge queue Jun 9, 2025
Merged via the queue into tskit-dev:main with commit 5ecc3f0 Jun 9, 2025
19 checks 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.

3 participants