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

Added edge_ec argument in draw to specify edge colors #575

Merged
merged 4 commits into from
Aug 30, 2024
Merged

Conversation

maximelucas
Copy link
Collaborator

This should fix #537

Excepted usage is mostly when using draw() with hull=True and white facecolors for edges with edge_fc="white".
Colors can be specified in all usual formats (same as edge_fc).

Technical trick: matplotlib does not automatically map numeric values to colors for edgecolors in PatchCollection so I had to map them manually with a ScalarMappable. The vmin, vmax; and cmap used for the mapping are the same as those from edge_fc.

Copy link

codecov bot commented Aug 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.13%. Comparing base (e01ddd5) to head (7a1ce61).
Report is 66 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #575      +/-   ##
==========================================
+ Coverage   92.51%   93.13%   +0.62%     
==========================================
  Files          59       60       +1     
  Lines        4393     4503     +110     
==========================================
+ Hits         4064     4194     +130     
+ Misses        329      309      -20     

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

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@maximelucas maximelucas requested a review from nwlandry August 30, 2024 10:44
Copy link
Collaborator

@nwlandry nwlandry left a comment

Choose a reason for hiding this comment

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

Two minor comments, but good to merge when you're ready. If you merge today, I can release 0.8.9 in time for your presentation.

xgi/drawing/draw_utils.py Outdated Show resolved Hide resolved
@@ -103,8 +103,8 @@ def _parse_color_arg(colors, ids, id_kind="edges"):
--------
colors : single color or ndarray
Processed color values for plotting.
colors_are_mapped : bool
True if the colors are mapped and need special handling. This
colors_to_map : bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

can this just be called map_colors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea that would work too I guess, but the colors are only mapped later in the draw function

@maximelucas maximelucas merged commit f25e0ca into main Aug 30, 2024
24 checks passed
@maximelucas maximelucas deleted the fix_537 branch August 30, 2024 16:42
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.

add back edgecolor argument to draw hulls with white face but colored contour
2 participants