Skip to content
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

Drawing hull as an option in draw_hyperedges #491

Merged
merged 21 commits into from
Nov 3, 2023
Merged

Drawing hull as an option in draw_hyperedges #491

merged 21 commits into from
Nov 3, 2023

Conversation

maximelucas
Copy link
Collaborator

@maximelucas maximelucas commented Nov 2, 2023

draw_hypergraph_hull was last function to make consistent #477. I noticed the edge-plotting part was doing exactly the same as draw_hyperedges except for the few lines drawing the hulls. So I:

  • added a hull=False and radius argument to draw_hyperedges, which needed just 10 more lines of code to work. So everything works out of the box because draw_hyperedges works.
  • added this option to draw so we can now do xgi.draw(H, hull=True).
  • removed draw_hypergraph_hull and _draw_hull as they are not used anymore.
  • fixed tests and updates notebooks
  • Change the default node_size everywhere to 7 (was 15). This was the size in the hull function, larger ones look bad. I think it also generally looks better for the non-hull ones. The only thing is that nodes now are by default too small for drawing node_labels, so the user needs to set a larger size if they want to do that but I think that's ok.
  • removed _color_arg_to_dict as not used anymore

This closes #477 and #388. Related to #404.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link

codecov bot commented Nov 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (de8a39c) 91.89% compared to head (1150648) 92.04%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #491      +/-   ##
==========================================
+ Coverage   91.89%   92.04%   +0.14%     
==========================================
  Files          60       60              
  Lines        4441     4372      -69     
==========================================
- Hits         4081     4024      -57     
+ Misses        360      348      -12     
Files Coverage Δ
xgi/drawing/draw.py 76.59% <100.00%> (-0.32%) ⬇️
xgi/drawing/draw_utils.py 92.85% <ø> (+1.94%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maximelucas maximelucas linked an issue Nov 2, 2023 that may be closed by this pull request
Copy link
Collaborator

@thomasrobiglio thomasrobiglio left a comment

Choose a reason for hiding this comment

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

Looks good @maximelucas, thank you.

Minor fixes:

  1. remove ref. in the API xgi.drawing.draw.rst
  2. I think the tutorial Tutorial 7 - Convex hulls hypergraph plotting.ipynb is better to put it in the in depth (as a separate one) or at the end of In Depth 2 - Drawing hyperedges.ipynb
  3. About the nodes' size change I think it is nice, looks cleaner this way. Maybe we should add a line somewhere in the docs telling the thing for the labels (that the user has to change the nodes' size manually)... or we can implement a thing that automatically draws the labels prop to node size (it's like that in graph tool), but I think in a new PR

@maximelucas
Copy link
Collaborator Author

Good ideas Thomas! Should be all good now.

For 3) I added a note in the docstrings. At first I thought we could just do the following to change it automatically like you said

if node_labels and node_size is None:
    node_size = 15

but by default node_size = 7 not None in the function call. So if we want to do it like this in another PR we would maybe need to set it to None and do inside of the function if node_size is None: node_size = 7...

@maximelucas maximelucas merged commit 4e829bc into main Nov 3, 2023
23 checks passed
@maximelucas maximelucas deleted the hull branch November 3, 2023 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants