feat(pl): hex color passthrough, outline_width for nodes, annotation vmin/vmax fix#53
feat(pl): hex color passthrough, outline_width for nodes, annotation vmin/vmax fix#53
Conversation
When a color attribute's values all start with '#' and are valid hex color codes, _get_colors now passes them through directly to matplotlib instead of routing through the categorical palette or numeric colormap. This lets users pre-assign per-cell/per-branch colors and have them rendered verbatim. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…h label=False - pl.nodes: add outline_width parameter (default None) that draws a black border around visible nodes. Uses per-node edgecolors so transparent na nodes never receive a visible outline. - pl.annotation: fix IndexError when label=False (labels=[]) is combined with vmin+vmax (which sets share_cmap=True) or an is_array key. The guards `if labels is not None` now use `if labels:` so an empty list correctly falls through to the auto-label logic. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
==========================================
+ Coverage 93.72% 93.92% +0.20%
==========================================
Files 35 35
Lines 2916 2932 +16
==========================================
+ Hits 2733 2754 +21
+ Misses 183 178 -5
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35c776a39b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| max_categories = 0 | ||
| if is_array: # single cmap for all columns | ||
| label = labels[0] if labels is not None else keys[0] | ||
| label = labels[0] if labels else keys[0] |
There was a problem hiding this comment.
Avoid boolean-casting arbitrary label sequences
This truthiness check will raise for valid Sequence[str] inputs like numpy.ndarray or pandas.Index (both commonly used to pass labels), because if labels triggers their ambiguous truth-value error. That makes annotation(..., label=<array-like>) crash in the is_array path even though this worked before the change (is not None), so the regression can break existing plotting calls that derive labels from array/index objects.
Useful? React with 👍 / 👎.
Summary
outline_widthfor nodes: New parameter draws a black outline around visible node markers; transparent (NA) nodes are excluded from the outline.annotationvmin/vmax fix withlabel=False: FixedIndexErrorwhenlabel=Falseis passed alongsidevmin/vmaxby guarding against empty label lists.Test plan
test_hex_color_branches— branches render using raw hex RGBA valuestest_hex_color_nodes— nodes render using raw hex RGBA valuestest_nodes_outline_width— outline applied to visible nodes only; NA nodes stay transparenttest_annotation_vmin_vmax_label_false— no error whenlabel=Falsewithvmin/vmax🤖 Generated with Claude Code