Repository navigation
feat: add drawing color and transparency controls - #102
Merged
john-boyer-phd merged 5 commits intoSep 17, 2026
Merged
john-boyer-phd merged 5 commits into
john-boyer-phd merged 5 commits into
Conversation
7 tasks
…lozada-santos/planarity into pr/kevin-lozada-santos/102
john-boyer-phd
approved these changes
Sep 17, 2026
john-boyer-phd
left a comment
Member
There was a problem hiding this comment.
Looks all good, thanks Kevin. Just had to adapt the zorder so that the edges wouldn't overlap the vertex border color. Good catch updating the test with the new default facecolor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #101
Type of change
Changes
Added
examples/classic/draw_planar_colors.py: generates all sevenK5-minus-edge_<property>.pngvariants, changing one requested option in each call.tests/test_draw_colors.py: 26 real-renderer cases across theplanarity.draw()andPGraph.draw()APIs. Checks artist colors, exported PNG alpha/background pixels, combined options without labels, default reset between calls, existing figure controls, and invalid colors/unknown keywords.Updated
planarity/classic/planarity.pyx: supportsfacecolor,transparent,vertex_facecolor,vertex_bordercolor,vertex_label_facecolor,vertex_label_bordercolor, andedge_linecolor. Applies vertex colors at the PatchCollection level, where Matplotlib renders them. Explicit export colors remain effective even whensavefig.facecoloris set by a user style.planarity/classic/planarity_functions.py: documents all forwarded options.README.mdandexamples/classic/output/K5-minus-edge.png: use the black vertex-border variant after visual comparison with the old example.The background default uses the issue's explicit
#f0f0f0value (near-white); callers can requestwhiteexplicitly. Vertex and edge colors retain their Matplotlib defaults when omitted, and label rectangles remain white with black borders.transparent=Truemakes the saved figure/axes backgrounds transparent, while retaining visible vertex/label colors; it is not a color-key operation. If saving later withoutoutfileName, passtransparenttosavefig()directly.Removed
None.
Testing
git diff --checkpasses.Reproduce the validation
The sample produces one PNG per requested property. The README image is a byte-for-byte copy of the generated vertex-border variant.
This targets current
master. PR #98's classic-to-express rename will overlap paths; this PR does not perform that rename. Local validation covers Python 3.11 on Windows; the upstream Python/Ubuntu matrix remains separate.